diff --git a/Sources/BowlingLib/Class1.cs b/Sources/BowlingLib/Class1.cs deleted file mode 100644 index 31eb072..0000000 --- a/Sources/BowlingLib/Class1.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace HelloWorldLib -{ - /// - ///a sample class - /// - public class Class1 - { - } -} diff --git a/Sources/BowlingLib/Model/Equipe.cs b/Sources/BowlingLib/Model/Equipe.cs index 2f4ca58..f1ca28b 100644 --- a/Sources/BowlingLib/Model/Equipe.cs +++ b/Sources/BowlingLib/Model/Equipe.cs @@ -1,4 +1,8 @@ +<<<<<<< HEAD using System; +======= +using System; +>>>>>>> origin/CreationTest using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/Sources/BowlingLib/Model/Joueur.cs b/Sources/BowlingLib/Model/Joueur.cs index 879038f..cf10721 100644 --- a/Sources/BowlingLib/Model/Joueur.cs +++ b/Sources/BowlingLib/Model/Joueur.cs @@ -14,9 +14,9 @@ namespace BowlingLib.Model { this.pseudo = pseudo; - if (pseudo == null || pseudo == "") + if (pseudo == null || pseudo == "" || pseudo.Length < 3) { - throw new Exception("Le pseudo ne peut pas être vide"); + throw new ArgumentException("Le pseudo ne peut pas être vide"); } } diff --git a/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj b/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj index 73961d6..13f9b25 100644 --- a/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj +++ b/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj @@ -1,25 +1,25 @@ - - - - net6.0 - - false - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - + + + + net6.0 + + false + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + diff --git a/Sources/Tests/BowlingAppUnitTest/UnitTest1.cs b/Sources/Tests/BowlingAppUnitTest/UnitTest1.cs deleted file mode 100644 index 69d7a2a..0000000 --- a/Sources/Tests/BowlingAppUnitTest/UnitTest1.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using HelloWorldLib; -using Xunit; - -namespace HelloWordLib_UnitTests -{ - public class UnitTest1 - { - [Fact] - public void Test1() - { - Class1 c = new Class1(); - Assert.NotNull(c); - } - } -} diff --git a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs new file mode 100644 index 0000000..3d735d3 --- /dev/null +++ b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs @@ -0,0 +1,50 @@ +using System; +using BowlingLib.Model; +using Xunit; + +namespace Test.BowlingAppUnitTest +{ + public class UnitTestJoueur + { + Joueur j = new Joueur("Paul"); + [Fact] + public void TestConstructeur() + { + Assert.NotNull(j); + Assert.Equal( "Paul",j.Pseudo); + Assert.NotEqual("joel",j.Pseudo ); + } + + [Fact] + public void TestInvalidJoueur() + { + Assert.Throws(() => new Joueur(null)); + } + + [Theory] + // [InlineData(false,"Augustin","Augustinn")] + [InlineData(true,"Amir","Amir")] + [InlineData(false,"Amir","")] + [InlineData(false,"Amir",null)] + [InlineData(false,null,null)] + [InlineData(false,null,"")] + [InlineData(false,"",null)] + [InlineData(false,"","")] + [InlineData(false,"f2","f2")] + + public void TestContructeur(bool isValid, string expectedPseudo, String pseudo ) + { + if (!isValid) + { + Assert.Throws( + () => new Joueur(pseudo) + ); + return; + } + Joueur j = new Joueur(pseudo); + Assert.Equal(expectedPseudo, j.Pseudo); + + + } + } +} diff --git a/Sources/global.json b/Sources/global.json new file mode 100644 index 0000000..87aef9f --- /dev/null +++ b/Sources/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "6.0.0", + "rollForward": "latestMajor", + "allowPrerelease": false + } +} \ No newline at end of file