From 185863c7e90a2178fc90b366586831d5ac333e08 Mon Sep 17 00:00:00 2001 From: "augustin.affognon" Date: Sun, 23 Oct 2022 14:32:11 +0200 Subject: [PATCH] Correction --- Sources/BowlingLib/Model/Equipe.cs | 19 ++++++++----------- Sources/BowlingLib/Model/Joueur.cs | 6 +++++- .../Tests/BowlingAppUnitTest/UTestEquipe.cs | 1 + .../BowlingAppUnitTest/UnitTestJoueur.cs | 6 +++++- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Sources/BowlingLib/Model/Equipe.cs b/Sources/BowlingLib/Model/Equipe.cs index e8df91b..df67577 100644 --- a/Sources/BowlingLib/Model/Equipe.cs +++ b/Sources/BowlingLib/Model/Equipe.cs @@ -13,8 +13,8 @@ namespace BowlingLib.Model /// public class Equipe { - public string Nom { get; private set; }; - public long Id { get; private set; }; + public string Nom { get; private set; } + public long Id { get; private set; } public ReadOnlyCollection Joueurs { get; private set; } @@ -30,17 +30,14 @@ namespace BowlingLib.Model - public Equipe(string nom, params Joueur[] joueurs) + /* public Equipe(string nom, params Joueur[] joueurs) { - this.nom = nom; + this.Nom = nom; AjouterJoueurs(joueurs); // foreach (Joueur nouv in joueurs) AjouterJoueur(nouv); - } - public long Id - { - get { return id; } - } + }*/ + public Equipe(string nom) @@ -54,10 +51,10 @@ namespace BowlingLib.Model // Joueurs = joueurs; Nom = nom; Joueurs = new ReadOnlyCollection(this.joueurs); - AjouterJoueurs(artists); + AjouterJoueurs(joueurs); } - public Equipe(long id, string nom, params Joueur[] joueurs) + public Equipe(string nom, params Joueur[] joueurs) : this(0, nom, joueurs) {} /// diff --git a/Sources/BowlingLib/Model/Joueur.cs b/Sources/BowlingLib/Model/Joueur.cs index f6580f4..c83c52e 100644 --- a/Sources/BowlingLib/Model/Joueur.cs +++ b/Sources/BowlingLib/Model/Joueur.cs @@ -43,10 +43,14 @@ namespace BowlingLib.Model } public bool Equals(Joueur other) - { + { return Pseudo.Equals(other.Pseudo); } + public void setNom(string nom) + { + Pseudo = nom; + } public override bool Equals(object obj) { diff --git a/Sources/Tests/BowlingAppUnitTest/UTestEquipe.cs b/Sources/Tests/BowlingAppUnitTest/UTestEquipe.cs index 65f1434..41eb0c4 100644 --- a/Sources/Tests/BowlingAppUnitTest/UTestEquipe.cs +++ b/Sources/Tests/BowlingAppUnitTest/UTestEquipe.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using BowlingLib.Model; using Xunit; diff --git a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs index 5171dba..b829350 100644 --- a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs +++ b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs @@ -93,13 +93,17 @@ namespace Test.BowlingAppUnitTest } + /* + * TEST AVEC LE STUB + */ + [Fact] public void TestUpdate() { StubJoueur stub = new StubJoueur(); Joueur j = new Joueur("Paul"); stub.Add(j); - j.Pseudo = "Augustin"; + j.setNom("Augustin"); stub.Update(j); Assert.Equal("Augustin", stub.GetAll().First().Pseudo); }