From 3a60868f0ea122cbdc189238f9b0f178174469a7 Mon Sep 17 00:00:00 2001 From: "pauline.prady" Date: Wed, 15 May 2024 00:37:17 +0200 Subject: [PATCH] Modification noms des fonctions tests --- Sources/UnitTesting/CodeUT.cs | 28 +++++++++---------- Sources/UnitTesting/JetonUT.cs | 2 +- Sources/UnitTesting/JoueurUT.cs | 2 +- Sources/UnitTesting/PartieUT.cs | 33 +++++++++++++++++++++++ Sources/UnitTesting/PlateauUT.cs | 8 +++--- Sources/UnitTesting/ReglesClassiquesUT.cs | 10 +++---- Sources/UnitTesting/UnitTesting.csproj | 1 + 7 files changed, 59 insertions(+), 25 deletions(-) create mode 100644 Sources/UnitTesting/PartieUT.cs diff --git a/Sources/UnitTesting/CodeUT.cs b/Sources/UnitTesting/CodeUT.cs index 4f2a6a1..0911ac4 100644 --- a/Sources/UnitTesting/CodeUT.cs +++ b/Sources/UnitTesting/CodeUT.cs @@ -7,7 +7,7 @@ namespace UnitTesting public class CodeUT { [Fact] - public void TestFirstConstructorValidArguments() + public void TestPremierConstructeurValide() { Code code = new Code(4); Assert.NotNull(code); @@ -16,14 +16,14 @@ namespace UnitTesting } [Fact] - public void TestConstructorInvalidArguments() + public void TestPremierConstructeurInvalide() { Assert.Throws(() => new Code(0)); Assert.Throws(() => new Code(-1)); } [Fact] - public void TestSecondConstructorValidArguments() + public void TestDeuxiemeConstructeurValide() { Jeton[] jetons = [new Jeton(Couleur.ROUGE), new Jeton(Couleur.BLEU), new Jeton(Couleur.BLEU)]; @@ -34,13 +34,13 @@ namespace UnitTesting } [Fact] - public void TestSecondConstructorInvalidArguments() + public void TestDeuxiemeConstructeurInvalide() { Assert.Throws(() => new Code([])); } [Fact] - public void TestAjouterJetonValid() + public void TestAjouterJetonValide() { Jeton jeton = new Jeton(Couleur.JAUNE); Code code = new Code(3); @@ -50,14 +50,14 @@ namespace UnitTesting } [Fact] - public void TestAjouterJetonInvalid() + public void TestAjouterJetonInvalide() { Code code = new Code([new Jeton(Couleur.NOIR)]); Assert.Throws(() => code.AjouterJeton(new Jeton(Couleur.ROUGE))); } [Fact] - public void TestSupprimerDernierJetonValid() + public void TestSupprimerDernierJetonValide() { Code code = new Code([new Jeton(Couleur.ROUGE), new Jeton(Couleur.BLEU), new Jeton(Couleur.BLANC)]); code.SupprimerDernierJeton(); @@ -65,14 +65,14 @@ namespace UnitTesting } [Fact] - public void TestSupprimerDernierJetonInvalid() + public void TestSupprimerDernierJetonInvalide() { Code code = new Code(4); Assert.Throws(() => code.SupprimerDernierJeton()); } [Fact] - public void TestRecupererJetonValid() + public void TestRecupererJetonValide() { Code code = new Code([new Jeton(Couleur.ROUGE), new Jeton(Couleur.BLEU), new Jeton(Couleur.BLANC)]); Jeton jetonAttendu = new Jeton(Couleur.BLEU); @@ -81,7 +81,7 @@ namespace UnitTesting } [Fact] - public void TestRecupererJetonInvalid() + public void TestRecupererJetonInvalide() { Code code = new Code(4); Assert.Throws(() => code.RecupererJeton(-1)); @@ -96,7 +96,7 @@ namespace UnitTesting } [Fact] - public void TestJetonsValid() + public void TestJetonsValide() { Jeton[] jetonsAttendus = [new Jeton(Couleur.ROUGE), new Jeton(Couleur.BLEU), new Jeton(Couleur.BLEU)]; Code code = new Code(jetonsAttendus); @@ -113,7 +113,7 @@ namespace UnitTesting } [Fact] - public void TestEstCompletValid() + public void TestEstCompletValide() { Code code = new Code([new Jeton(Couleur.ROUGE), new Jeton(Couleur.BLEU), new Jeton(Couleur.BLANC)]); bool estComplet = code.EstComplet(); @@ -121,7 +121,7 @@ namespace UnitTesting } [Fact] - public void TestEstCompletInvalid() + public void TestEstCompletInvalide() { Code code = new Code(3); bool estComplet = code.EstComplet(); @@ -129,7 +129,7 @@ namespace UnitTesting } [Fact] - public void TestTailleMaximaleValid() + public void TestTailleMaximaleValide() { Jeton[] jetons = [new Jeton(Couleur.ROUGE), new Jeton(Couleur.BLEU), new Jeton(Couleur.BLEU)]; Code code = new Code(jetons); diff --git a/Sources/UnitTesting/JetonUT.cs b/Sources/UnitTesting/JetonUT.cs index e315b41..0af1ec5 100644 --- a/Sources/UnitTesting/JetonUT.cs +++ b/Sources/UnitTesting/JetonUT.cs @@ -6,7 +6,7 @@ namespace UnitTesting public class JetonUT { [Fact] - public void TestConstructorValid() + public void TestConstructeurValide() { Couleur[] listeCouleurs = (Couleur[])Enum.GetValues(typeof(Couleur)); diff --git a/Sources/UnitTesting/JoueurUT.cs b/Sources/UnitTesting/JoueurUT.cs index d105743..aaf6f81 100644 --- a/Sources/UnitTesting/JoueurUT.cs +++ b/Sources/UnitTesting/JoueurUT.cs @@ -6,7 +6,7 @@ namespace UnitTesting public class JoueurUT { [Fact] - public void TestConstructorWithValidArguments() + public void TestConstructeurValide() { Plateau plateau = new Plateau(4, 10); Joueur joueur = new Joueur("MonJoueur", plateau); diff --git a/Sources/UnitTesting/PartieUT.cs b/Sources/UnitTesting/PartieUT.cs new file mode 100644 index 0000000..8ce6f65 --- /dev/null +++ b/Sources/UnitTesting/PartieUT.cs @@ -0,0 +1,33 @@ +using CoreLibrary; +using CoreLibrary.Exceptions; +using System.Reflection; +using Xunit; + +namespace UnitTesting +{ + public class PartieUT + { + [Fact] + public void TestJouer() + { + //ReglesClassiques regles = new ReglesClassiques(); + //Partie partie = new Partie(regles); + + //partie.Jouer(); + + //Assert.True(regles.EstTerminee()); + + //IEnumerable gagnants = regles.Gagnants(); + //IEnumerable perdants = regles.Perdants(); + + //Assert.NotEmpty(gagnants); + //Assert.All(gagnants, joueur => Assert.DoesNotContain(joueur, perdants)); + + //foreach (var joueur in regles.joueurs()) + //{ + //Assert.NotNull(joueur.Plateau); + //Assert.True(joueur.Plateau.EstComplet()); + //} + } + } +} diff --git a/Sources/UnitTesting/PlateauUT.cs b/Sources/UnitTesting/PlateauUT.cs index 1012b35..dc88673 100644 --- a/Sources/UnitTesting/PlateauUT.cs +++ b/Sources/UnitTesting/PlateauUT.cs @@ -8,7 +8,7 @@ namespace UnitTesting public class PlateauUT { [Fact] - public void TestConstructorValid() + public void TestConstructeurValide() { Plateau plateau = new Plateau(4,12); Assert.NotNull(plateau); @@ -17,7 +17,7 @@ namespace UnitTesting } [Fact] - public void TestConstructorInvalid() + public void TestConstructeurInvalide() { Assert.Throws(() => new Plateau(0, 10)); Assert.Throws(() => new Plateau(3, 0)); @@ -193,7 +193,7 @@ namespace UnitTesting } [Fact] - public void TestGrilleValid() + public void TestGrilleValide() { Plateau plateau = new Plateau(4, 3); Code code1 = new Code([new Jeton(Couleur.BLEU), new Jeton(Couleur.BLANC), new Jeton(Couleur.JAUNE), new Jeton(Couleur.BLANC)]); @@ -212,7 +212,7 @@ namespace UnitTesting } [Fact] - public void TestGrilleEmpty() + public void TestGrilleVide() { Plateau plateau = new Plateau(4, 3); diff --git a/Sources/UnitTesting/ReglesClassiquesUT.cs b/Sources/UnitTesting/ReglesClassiquesUT.cs index 89e3597..d0aa497 100644 --- a/Sources/UnitTesting/ReglesClassiquesUT.cs +++ b/Sources/UnitTesting/ReglesClassiquesUT.cs @@ -14,7 +14,7 @@ namespace UnitTesting Assert.Equal("Règles classiques", regle.Nom); } [Fact] - public void TestConstructor() + public void TestConstructeur() { ReglesClassiques regles = new ReglesClassiques(); @@ -34,7 +34,7 @@ namespace UnitTesting } [Fact] - public void TestJoueurCourantWithPlayer() + public void TestJoueurCourantAvecJoueur() { ReglesClassiques regles = new ReglesClassiques(); regles.AjouterJoueur("joueur1"); @@ -48,14 +48,14 @@ namespace UnitTesting } [Fact] - public void TestJoueurCourantNoPlayer() + public void TestJoueurCourantSansJoueur() { ReglesClassiques regles = new ReglesClassiques(); Assert.Throws(() => regles.JoueurCourant()); } [Fact] - public void TestPasserLaMainValid() + public void TestPasserLaMainValide() { ReglesClassiques regles = new ReglesClassiques(); regles.AjouterJoueur("joueur1"); @@ -93,7 +93,7 @@ namespace UnitTesting } [Fact] - public void TestPasserLaMainInvalid() + public void TestPasserLaMainInvalide() { ReglesClassiques regles = new ReglesClassiques(); Assert.Throws(() => regles.PasserLaMain()); diff --git a/Sources/UnitTesting/UnitTesting.csproj b/Sources/UnitTesting/UnitTesting.csproj index 3586adb..66853b1 100644 --- a/Sources/UnitTesting/UnitTesting.csproj +++ b/Sources/UnitTesting/UnitTesting.csproj @@ -23,6 +23,7 @@ +