From d8c001b78d57d1c51593334fe8ec1ac1dc970295 Mon Sep 17 00:00:00 2001 From: victor perez ngounou Date: Fri, 23 Sep 2022 13:27:24 +0200 Subject: [PATCH 01/24] Classe joueur --- Sources/BowlingLib/Model/Joueur.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Sources/BowlingLib/Model/Joueur.cs b/Sources/BowlingLib/Model/Joueur.cs index b11bc5c..879038f 100644 --- a/Sources/BowlingLib/Model/Joueur.cs +++ b/Sources/BowlingLib/Model/Joueur.cs @@ -6,7 +6,25 @@ using System.Threading.Tasks; namespace BowlingLib.Model { - internal class Joueur + public class Joueur { + private string pseudo; + + public Joueur(string pseudo) + { + this.pseudo = pseudo; + + if (pseudo == null || pseudo == "") + { + throw new Exception("Le pseudo ne peut pas être vide"); + } + } + + public string Pseudo + { + get { return pseudo; } + private set { pseudo = value; } + } + } } -- 2.36.3 From 3e80afc3dd1f9e08c6e92f05006bc337a64eda5d Mon Sep 17 00:00:00 2001 From: victor perez ngounou Date: Sat, 24 Sep 2022 15:10:05 +0200 Subject: [PATCH 02/24] Test unitaire joueur --- Sources/BowlingLib/Class1.cs | 11 --------- Sources/BowlingLib/Model/Joueur.cs | 2 +- Sources/Tests/BowlingAppUnitTest/UnitTest1.cs | 16 ------------- .../BowlingAppUnitTest/UnitTestJoueur.cs | 24 +++++++++++++++++++ Sources/global.json | 7 ++++++ 5 files changed, 32 insertions(+), 28 deletions(-) delete mode 100644 Sources/BowlingLib/Class1.cs delete mode 100644 Sources/Tests/BowlingAppUnitTest/UnitTest1.cs create mode 100644 Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs create mode 100644 Sources/global.json 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/Joueur.cs b/Sources/BowlingLib/Model/Joueur.cs index 879038f..5bfd53d 100644 --- a/Sources/BowlingLib/Model/Joueur.cs +++ b/Sources/BowlingLib/Model/Joueur.cs @@ -16,7 +16,7 @@ namespace BowlingLib.Model if (pseudo == null || pseudo == "") { - 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/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..510031d --- /dev/null +++ b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs @@ -0,0 +1,24 @@ +using System; +using BowlingLib.Model; +using Xunit; + +namespace Test.BowlingAppUnitTest +{ + public class UnitTestJoueur + { + [Fact] + public void TestConstructeur() + { + Joueur j = new Joueur("Paul"); + Assert.NotNull(j); + Assert.Equal(j.Pseudo, "Paul"); + Assert.NotEqual(j.Pseudo, "joel"); + } + + [Fact] + public void TestInvalidJoueur() + { + Assert.Throws(() => new Joueur(null)); + } + } +} 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 -- 2.36.3 From eef064c3d67643b0e0ff9ea72623d61683af1dd4 Mon Sep 17 00:00:00 2001 From: victor perez ngounou Date: Sat, 24 Sep 2022 16:59:25 +0200 Subject: [PATCH 03/24] =?UTF-8?q?Cr=C3=A9ation=20des=20classes=20Frames,?= =?UTF-8?q?=20Lancer=20et=20Partie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/BowlingLib/Model/Frame.cs | 209 +++++++++++++++++++++++++++++ Sources/BowlingLib/Model/Lancer.cs | 34 +++++ Sources/BowlingLib/Model/Partie.cs | 57 ++++++++ 3 files changed, 300 insertions(+) create mode 100644 Sources/BowlingLib/Model/Frame.cs create mode 100644 Sources/BowlingLib/Model/Lancer.cs create mode 100644 Sources/BowlingLib/Model/Partie.cs diff --git a/Sources/BowlingLib/Model/Frame.cs b/Sources/BowlingLib/Model/Frame.cs new file mode 100644 index 0000000..82fd0ac --- /dev/null +++ b/Sources/BowlingLib/Model/Frame.cs @@ -0,0 +1,209 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BowlingLib.Model +{ + public class Frame + { + private int numero; + private int score; + private int quillesRestantes; + private int quillesTombees; + private bool isStrike; + private bool isSpare; + private bool isFinished; + private Lancer lancer1; + private Lancer lancer2; + private Lancer lancer3; + + public int Numero + { + get { return numero; } + set { numero = value; } + } + + public int Score + { + get { return score; } + set { score = value; } + } + + public int QuillesRestantes + { + get { return quillesRestantes; } + set { quillesRestantes = value; } + } + + public int QuillesTombees + { + get { return quillesTombees; } + set { quillesTombees = value; } + } + + public bool IsStrike + { + get { return isStrike; } + set { isStrike = value; } + } + + public bool IsSpare + { + get { return isSpare; } + set { isSpare = value; } + } + + public bool IsFinished + { + get { return isFinished; } + set { isFinished = value; } + } + + public Lancer Lancer1 + { + get { return lancer1; } + set { lancer1 = value; } + } + + public Lancer Lancer2 + { + get { return lancer2; } + set { lancer2 = value; } + } + + public Lancer Lancer3 + { + get { return lancer3; } + set { lancer3 = value; } + } + + public Frame(int numero) + { + this.numero = numero; + this.quillesRestantes = 10; + this.isFinished = false; + this.isStrike = false; + this.isSpare = false; + } + + public void Lancer(int quillesTombees) + { + if (quillesTombees > quillesRestantes) + { + throw new ArgumentException("Le nombre de quilles tombees doit etre inferieur au nombre de quilles restantes"); + } + if (quillesTombees < 0) + { + throw new ArgumentException("Le nombre de quilles tombees doit et etre positif"); + } + + if (this.numero == 10) + { + if (this.lancer1 == null) + { + this.lancer1 = new Lancer(quillesTombees); + this.quillesRestantes -= quillesTombees; + this.quillesTombees += quillesTombees; + if (quillesTombees == 10) + { + this.isStrike = true; + } + } + else if (this.lancer2 == null) + { + this.lancer2 = new Lancer(quillesTombees); + this.quillesRestantes -= quillesTombees; + this.quillesTombees += quillesTombees; + if (this.isStrike) + { + if (quillesTombees == 10) + { + this.isStrike = true; + } + else + { + this.isStrike = false; + } + } + else + { + if (quillesTombees + this.lancer1.QuillesTombees == 10) + { + this.isSpare = true; + } + } + } + else if (this.lancer3 == null) + { + this.lancer3 = new Lancer(quillesTombees); + this.quillesRestantes -= quillesTombees; + this.quillesTombees += quillesTombees; + if (this.isStrike) + { + if (quillesTombees == 10) + { + this.isStrike = true; + } + else + { + this.isStrike = false; + } + } + else if (this.isSpare) + { + if (quillesTombees + this.lancer2.QuillesTombees == 10) + { + this.isSpare = true; + } + else + { + this.isSpare = false; + } + } + else + { + if (quillesTombees + this.lancer2.QuillesTombees == 10) + { + this.isSpare = true; + } + } + } + else + { + throw new ArgumentException("Le nombre de lancers est deja atteint"); + } + } + else + { + if (this.lancer1 == null) + { + this.lancer1 = new Lancer(quillesTombees); + } + else if (this.lancer2 == null) + { + this.lancer2 = new Lancer(quillesTombees); + } + else + { + throw new ArgumentException("Le nombre de lancers est deja atteint"); + } + this.quillesRestantes -= quillesTombees; + this.quillesTombees += quillesTombees; + if (quillesTombees == 10) + { + this.isStrike = true; + } + else if (this.quillesRestantes == 0) + { + this.isSpare = true; + } + } + if (this.quillesRestantes == 0 || this.lancer2 != null) + { + this.isFinished = true; + } + } + } +} diff --git a/Sources/BowlingLib/Model/Lancer.cs b/Sources/BowlingLib/Model/Lancer.cs new file mode 100644 index 0000000..ad447ce --- /dev/null +++ b/Sources/BowlingLib/Model/Lancer.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BowlingLib.Model +{ + public class Lancer + { + private int quillesTombees; + + public int QuillesTombees + { + get { return quillesTombees; } + set + { + if (value < 0 || value > 10) + { + throw new ArgumentException("Le nombre de quilles tombees doit etre compris entre 0 et 10"); + } + quillesTombees = value; + } + } + + public Lancer(int quillesTombees) + { + this.quillesTombees = quillesTombees; + } + + + + } +} diff --git a/Sources/BowlingLib/Model/Partie.cs b/Sources/BowlingLib/Model/Partie.cs new file mode 100644 index 0000000..c5d462e --- /dev/null +++ b/Sources/BowlingLib/Model/Partie.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BowlingLib.Model +{ + public class Partie + { + private Joueur joueur; + private List frames; + + public Joueur Joueur + { + get { return joueur; } + set { joueur = value; } + } + + public List Frames + { + get { return frames; } + set { frames = value; } + } + + public Partie(Joueur joueur) + { + this.joueur = joueur; + frames = new List(); + } + + public void AddFrame(Frame frame) + { + frames.Add(frame); + } + + public int GetScore() + { + int score = 0; + foreach (Frame frame in frames) + { + score += frame.Score; + } + return score; + } + + public int GetScore(int frameNumber) + { + int score = 0; + for (int i = 0; i < frameNumber; i++) + { + score += frames[i].Score; + } + return score; + } + } +} -- 2.36.3 From b9440010181cbccb1b69bf804c703cd101f7a9c2 Mon Sep 17 00:00:00 2001 From: victor perez ngounou Date: Sun, 25 Sep 2022 16:57:22 +0200 Subject: [PATCH 04/24] =?UTF-8?q?Cr=C3=A9ation=20de=20la=20classe=20equipe?= =?UTF-8?q?=20et=20de=20la=20methode=20score=20dans=20la=20classe=20partie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/BowlingLib/Model/Equipe.cs | 48 +++++++++ Sources/BowlingLib/Model/Frame.cs | 160 ++++++++++------------------- Sources/BowlingLib/Model/Partie.cs | 50 ++++----- 3 files changed, 123 insertions(+), 135 deletions(-) create mode 100644 Sources/BowlingLib/Model/Equipe.cs diff --git a/Sources/BowlingLib/Model/Equipe.cs b/Sources/BowlingLib/Model/Equipe.cs new file mode 100644 index 0000000..2f4ca58 --- /dev/null +++ b/Sources/BowlingLib/Model/Equipe.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BowlingLib.Model +{ + public class Equipe + { + private string nom; + private List joueurs; + + public string Nom + { + get { return nom; } + set { nom = value; } + } + + public List Joueurs + { + get { return joueurs; } + set { joueurs = value; } + } + + public Equipe(string nom) + { + this.nom = nom; + joueurs = new List(); + } + + public void AjouterJoueur(Joueur joueur) + { + joueurs.Add(joueur); + } + + public void SupprimerJoueur(Joueur joueur) + { + joueurs.Remove(joueur); + } + + //retourner la liste non modifiable des joueurs de l'équipe + public List GetJoueurs() + { + return joueurs.AsReadOnly().ToList(); + } + } +} diff --git a/Sources/BowlingLib/Model/Frame.cs b/Sources/BowlingLib/Model/Frame.cs index 82fd0ac..7638e41 100644 --- a/Sources/BowlingLib/Model/Frame.cs +++ b/Sources/BowlingLib/Model/Frame.cs @@ -8,89 +8,37 @@ namespace BowlingLib.Model { public class Frame { - private int numero; - private int score; - private int quillesRestantes; - private int quillesTombees; - private bool isStrike; - private bool isSpare; - private bool isFinished; - private Lancer lancer1; - private Lancer lancer2; - private Lancer lancer3; + public int Numero { get; set; } - public int Numero - { - get { return numero; } - set { numero = value; } - } - public int Score - { - get { return score; } - set { score = value; } - } + public int QuillesRestantes { get; set; } - public int QuillesRestantes - { - get { return quillesRestantes; } - set { quillesRestantes = value; } - } + public int QuillesTombees { get; set; } - public int QuillesTombees - { - get { return quillesTombees; } - set { quillesTombees = value; } - } + public bool IsStrike { get; set; } - public bool IsStrike - { - get { return isStrike; } - set { isStrike = value; } - } + public bool IsSpare { get; set; } - public bool IsSpare - { - get { return isSpare; } - set { isSpare = value; } - } + public bool IsFinished { get; set; } - public bool IsFinished - { - get { return isFinished; } - set { isFinished = value; } - } - - public Lancer Lancer1 - { - get { return lancer1; } - set { lancer1 = value; } - } + public Lancer Lancer1 { get; set; } - public Lancer Lancer2 - { - get { return lancer2; } - set { lancer2 = value; } - } + public Lancer Lancer2 { get; set; } - public Lancer Lancer3 - { - get { return lancer3; } - set { lancer3 = value; } - } + public Lancer Lancer3 { get; set; } public Frame(int numero) { - this.numero = numero; - this.quillesRestantes = 10; - this.isFinished = false; - this.isStrike = false; - this.isSpare = false; + this.Numero = numero; + this.QuillesRestantes = 10; + this.IsFinished = false; + this.IsStrike = false; + this.IsSpare = false; } public void Lancer(int quillesTombees) { - if (quillesTombees > quillesRestantes) + if (quillesTombees > QuillesRestantes) { throw new ArgumentException("Le nombre de quilles tombees doit etre inferieur au nombre de quilles restantes"); } @@ -99,74 +47,74 @@ namespace BowlingLib.Model throw new ArgumentException("Le nombre de quilles tombees doit et etre positif"); } - if (this.numero == 10) + if (this.Numero == 10) { - if (this.lancer1 == null) + if (this.Lancer1 == null) { - this.lancer1 = new Lancer(quillesTombees); - this.quillesRestantes -= quillesTombees; - this.quillesTombees += quillesTombees; + this.Lancer1 = new Lancer(quillesTombees); + this.QuillesRestantes -= quillesTombees; + this.QuillesTombees += quillesTombees; if (quillesTombees == 10) { - this.isStrike = true; + this.IsStrike = true; } } - else if (this.lancer2 == null) + else if (this.Lancer2 == null) { - this.lancer2 = new Lancer(quillesTombees); - this.quillesRestantes -= quillesTombees; - this.quillesTombees += quillesTombees; - if (this.isStrike) + this.Lancer2 = new Lancer(quillesTombees); + this.QuillesRestantes -= quillesTombees; + this.QuillesTombees += quillesTombees; + if (this.IsStrike) { if (quillesTombees == 10) { - this.isStrike = true; + this.IsStrike = true; } else { - this.isStrike = false; + this.IsStrike = false; } } else { - if (quillesTombees + this.lancer1.QuillesTombees == 10) + if (quillesTombees + this.Lancer1.QuillesTombees == 10) { - this.isSpare = true; + this.IsSpare = true; } } } - else if (this.lancer3 == null) + else if (this.Lancer3 == null) { - this.lancer3 = new Lancer(quillesTombees); - this.quillesRestantes -= quillesTombees; - this.quillesTombees += quillesTombees; - if (this.isStrike) + this.Lancer3 = new Lancer(quillesTombees); + this.QuillesRestantes -= quillesTombees; + this.QuillesTombees += quillesTombees; + if (this.IsStrike) { if (quillesTombees == 10) { - this.isStrike = true; + this.IsStrike = true; } else { - this.isStrike = false; + this.IsStrike = false; } } - else if (this.isSpare) + else if (this.IsSpare) { - if (quillesTombees + this.lancer2.QuillesTombees == 10) + if (quillesTombees + this.Lancer2.QuillesTombees == 10) { - this.isSpare = true; + this.IsSpare = true; } else { - this.isSpare = false; + this.IsSpare = false; } } else { - if (quillesTombees + this.lancer2.QuillesTombees == 10) + if (quillesTombees + this.Lancer2.QuillesTombees == 10) { - this.isSpare = true; + this.IsSpare = true; } } } @@ -177,32 +125,32 @@ namespace BowlingLib.Model } else { - if (this.lancer1 == null) + if (this.Lancer1 == null) { - this.lancer1 = new Lancer(quillesTombees); + this.Lancer1 = new Lancer(quillesTombees); } - else if (this.lancer2 == null) + else if (this.Lancer2 == null) { - this.lancer2 = new Lancer(quillesTombees); + this.Lancer2 = new Lancer(quillesTombees); } else { throw new ArgumentException("Le nombre de lancers est deja atteint"); } - this.quillesRestantes -= quillesTombees; - this.quillesTombees += quillesTombees; + this.QuillesRestantes -= quillesTombees; + this.QuillesTombees += quillesTombees; if (quillesTombees == 10) { - this.isStrike = true; + this.IsStrike = true; } - else if (this.quillesRestantes == 0) + else if (this.QuillesRestantes == 0) { - this.isSpare = true; + this.IsSpare = true; } } - if (this.quillesRestantes == 0 || this.lancer2 != null) + if (this.QuillesRestantes == 0 || this.Lancer2 != null) { - this.isFinished = true; + this.IsFinished = true; } } } diff --git a/Sources/BowlingLib/Model/Partie.cs b/Sources/BowlingLib/Model/Partie.cs index c5d462e..9c78293 100644 --- a/Sources/BowlingLib/Model/Partie.cs +++ b/Sources/BowlingLib/Model/Partie.cs @@ -8,48 +8,40 @@ namespace BowlingLib.Model { public class Partie { - private Joueur joueur; - private List frames; - public Joueur Joueur - { - get { return joueur; } - set { joueur = value; } - } + public Joueur Joueur { get; set; } - public List Frames - { - get { return frames; } - set { frames = value; } - } + public List Frames { get; set; } public Partie(Joueur joueur) { - this.joueur = joueur; - frames = new List(); + this.Joueur = joueur; + Frames = new List(); } public void AddFrame(Frame frame) { - frames.Add(frame); - } - - public int GetScore() - { - int score = 0; - foreach (Frame frame in frames) - { - score += frame.Score; - } - return score; + Frames.Add(frame); } - public int GetScore(int frameNumber) + public int? GetScore() { - int score = 0; - for (int i = 0; i < frameNumber; i++) + int? score = 0; + for (int i = 0; i < Frames.Count; i++) { - score += frames[i].Score; + score += Frames[i].QuillesTombees; + if (Frames[i].IsStrike) + { + score += Frames[i + 1].QuillesTombees; + if (Frames[i + 1].IsStrike && i < Frames.Count - 2) + { + score += Frames[i + 2].QuillesTombees; + } + } + else if (Frames[i].IsSpare) + { + score += Frames[i + 1].Lancer1.QuillesTombees; + } } return score; } -- 2.36.3 From 837995a19715b68c752db02be17e7561ee6eab5b Mon Sep 17 00:00:00 2001 From: victor perez ngounou Date: Sun, 25 Sep 2022 17:16:20 +0200 Subject: [PATCH 05/24] Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 759a040..8d1bb87 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Welcome on the BowlingScoreApp project! - + _Generated with a_ **Code#0** _template_ \ No newline at end of file -- 2.36.3 From dd3c216052b7bab9333ddd9ef8820e7dd32e44f2 Mon Sep 17 00:00:00 2001 From: AUGUSTIN_100 Date: Sun, 25 Sep 2022 18:33:29 +0200 Subject: [PATCH 06/24] Test Sur Joueur --- Sources/BowlingLib/Model/Joueur.cs | 2 +- .../BowlingAppUnitTest/UnitTestJoueur.cs | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Sources/BowlingLib/Model/Joueur.cs b/Sources/BowlingLib/Model/Joueur.cs index 5bfd53d..cf10721 100644 --- a/Sources/BowlingLib/Model/Joueur.cs +++ b/Sources/BowlingLib/Model/Joueur.cs @@ -14,7 +14,7 @@ namespace BowlingLib.Model { this.pseudo = pseudo; - if (pseudo == null || pseudo == "") + if (pseudo == null || pseudo == "" || pseudo.Length < 3) { throw new ArgumentException("Le pseudo ne peut pas être vide"); } diff --git a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs index 510031d..b346d82 100644 --- a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs +++ b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs @@ -20,5 +20,30 @@ namespace Test.BowlingAppUnitTest { 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(pseudo, j.Pseudo); + } + } } } -- 2.36.3 From cb40d284abe1c8b6229ac2440492271036e3e2ea Mon Sep 17 00:00:00 2001 From: victor perez ngounou Date: Sun, 25 Sep 2022 19:10:07 +0200 Subject: [PATCH 07/24] Create Stub Lib --- Sources/BowlingStub/BowlingStub.csproj | 9 +++++++++ Sources/BowlingStub/StubPartie.cs | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100644 Sources/BowlingStub/BowlingStub.csproj create mode 100644 Sources/BowlingStub/StubPartie.cs diff --git a/Sources/BowlingStub/BowlingStub.csproj b/Sources/BowlingStub/BowlingStub.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/Sources/BowlingStub/BowlingStub.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/Sources/BowlingStub/StubPartie.cs b/Sources/BowlingStub/StubPartie.cs new file mode 100644 index 0000000..228b370 --- /dev/null +++ b/Sources/BowlingStub/StubPartie.cs @@ -0,0 +1,8 @@ +namespace BowlingStub +{ + public class StubPartie + { + + + } +} \ No newline at end of file -- 2.36.3 From a104bdf11d9f936947f006d066c0ef5048344454 Mon Sep 17 00:00:00 2001 From: victor perez ngounou Date: Sun, 25 Sep 2022 19:51:26 +0200 Subject: [PATCH 08/24] =?UTF-8?q?Cr=C3=A9ation=20de=20la=20classe=20Fa?= =?UTF-8?q?=C3=A7adeManager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/BowlingLib/Model/FacadeManager.cs | 12 ++++++++++++ Sources/Solution.sln | 6 ++++++ 2 files changed, 18 insertions(+) create mode 100644 Sources/BowlingLib/Model/FacadeManager.cs diff --git a/Sources/BowlingLib/Model/FacadeManager.cs b/Sources/BowlingLib/Model/FacadeManager.cs new file mode 100644 index 0000000..fe21397 --- /dev/null +++ b/Sources/BowlingLib/Model/FacadeManager.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BowlingLib.Model +{ + internal class FacadeManager + { + } +} diff --git a/Sources/Solution.sln b/Sources/Solution.sln index 4105d6d..1a82a6c 100644 --- a/Sources/Solution.sln +++ b/Sources/Solution.sln @@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BowlingApp", "BowlingApp\Bo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BowlingAppUnitTest", "Tests\BowlingAppUnitTest\BowlingAppUnitTest.csproj", "{F9B12DFD-EF58-429F-9344-70DFC10EC6E5}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BowlingStub", "BowlingStub\BowlingStub.csproj", "{8A978511-1AD6-47BE-A241-07A4E8BA8C0A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -29,6 +31,10 @@ Global {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Debug|Any CPU.Build.0 = Debug|Any CPU {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Release|Any CPU.ActiveCfg = Release|Any CPU {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Release|Any CPU.Build.0 = Release|Any CPU + {8A978511-1AD6-47BE-A241-07A4E8BA8C0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A978511-1AD6-47BE-A241-07A4E8BA8C0A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A978511-1AD6-47BE-A241-07A4E8BA8C0A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A978511-1AD6-47BE-A241-07A4E8BA8C0A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- 2.36.3 From 68aceda3fbc61137697f17904ad71ceefa3cef63 Mon Sep 17 00:00:00 2001 From: victor perez ngounou Date: Sun, 25 Sep 2022 19:10:07 +0200 Subject: [PATCH 09/24] Create Stub Lib --- Sources/BowlingStub/BowlingStub.csproj | 9 +++++++++ Sources/BowlingStub/StubPartie.cs | 8 ++++++++ Sources/Solution.sln | 6 ++++++ 3 files changed, 23 insertions(+) create mode 100644 Sources/BowlingStub/BowlingStub.csproj create mode 100644 Sources/BowlingStub/StubPartie.cs diff --git a/Sources/BowlingStub/BowlingStub.csproj b/Sources/BowlingStub/BowlingStub.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/Sources/BowlingStub/BowlingStub.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/Sources/BowlingStub/StubPartie.cs b/Sources/BowlingStub/StubPartie.cs new file mode 100644 index 0000000..228b370 --- /dev/null +++ b/Sources/BowlingStub/StubPartie.cs @@ -0,0 +1,8 @@ +namespace BowlingStub +{ + public class StubPartie + { + + + } +} \ No newline at end of file diff --git a/Sources/Solution.sln b/Sources/Solution.sln index 4105d6d..5078181 100644 --- a/Sources/Solution.sln +++ b/Sources/Solution.sln @@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BowlingApp", "BowlingApp\Bo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BowlingAppUnitTest", "Tests\BowlingAppUnitTest\BowlingAppUnitTest.csproj", "{F9B12DFD-EF58-429F-9344-70DFC10EC6E5}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BowlingStub", "BowlingStub\BowlingStub.csproj", "{B50615A5-ABFD-4A9C-B236-DBAEDE62AB2E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -29,6 +31,10 @@ Global {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Debug|Any CPU.Build.0 = Debug|Any CPU {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Release|Any CPU.ActiveCfg = Release|Any CPU {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Release|Any CPU.Build.0 = Release|Any CPU + {B50615A5-ABFD-4A9C-B236-DBAEDE62AB2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B50615A5-ABFD-4A9C-B236-DBAEDE62AB2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B50615A5-ABFD-4A9C-B236-DBAEDE62AB2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B50615A5-ABFD-4A9C-B236-DBAEDE62AB2E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- 2.36.3 From 6a7c8c5d4fbc6efd0ed14450a2059b79913b9cb8 Mon Sep 17 00:00:00 2001 From: AUGUSTIN_100 Date: Sun, 25 Sep 2022 20:20:32 +0200 Subject: [PATCH 10/24] Stub Joueur et Equipe --- Sources/BowlingLib/Model/Iloader.cs | 6 ++++++ Sources/BowlingStub/StubEquipe.cs | 24 ++++++++++++++++++++++++ Sources/BowlingStub/StubJoueur.cs | 18 ++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 Sources/BowlingLib/Model/Iloader.cs create mode 100644 Sources/BowlingStub/StubEquipe.cs create mode 100644 Sources/BowlingStub/StubJoueur.cs diff --git a/Sources/BowlingLib/Model/Iloader.cs b/Sources/BowlingLib/Model/Iloader.cs new file mode 100644 index 0000000..93593be --- /dev/null +++ b/Sources/BowlingLib/Model/Iloader.cs @@ -0,0 +1,6 @@ +using System; + +public interface Iloader +{ + +} diff --git a/Sources/BowlingStub/StubEquipe.cs b/Sources/BowlingStub/StubEquipe.cs new file mode 100644 index 0000000..ae8f036 --- /dev/null +++ b/Sources/BowlingStub/StubEquipe.cs @@ -0,0 +1,24 @@ +using System; + +public class StubEquipe +{ + private List listEquipes = new List(); + public StubEquipe() + { + } + + public List ListEquipes(int n = 10, int j = 2) + { + for (int i = 0; i < n; i++) + { + listEquipes.Add(new Equipe() { Nom = "Equipe " + i + 1 }); + + for(int k = 0; k < j; k++) + { + listEquipes.ElementAt(i).AjouterJoueur(new Joueur("Joueur " + i + 1 + "-" + k + 1)); + + } + } + } + +} diff --git a/Sources/BowlingStub/StubJoueur.cs b/Sources/BowlingStub/StubJoueur.cs new file mode 100644 index 0000000..9a8ad90 --- /dev/null +++ b/Sources/BowlingStub/StubJoueur.cs @@ -0,0 +1,18 @@ +using System; + +public class StubJoueur +{ +private List listJoueurs = new List(); + public StubJoueur() + { + } + + public List ListJoueurs(int n = 10) + { + for (int i = 0; i < n; i++) + { + listJoueurs.Add(new Joueur() { Pseudo = "Joueur "+i+1 }); + } + } + +} -- 2.36.3 From 158076e67868e9afb663f78c956e4f95ab10c539 Mon Sep 17 00:00:00 2001 From: vpngounou Date: Wed, 28 Sep 2022 10:29:05 +0200 Subject: [PATCH 11/24] Update --- Sources/Solution.sln | 2 -- 1 file changed, 2 deletions(-) diff --git a/Sources/Solution.sln b/Sources/Solution.sln index 1a82a6c..8c865f2 100644 --- a/Sources/Solution.sln +++ b/Sources/Solution.sln @@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BowlingApp", "BowlingApp\Bo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BowlingAppUnitTest", "Tests\BowlingAppUnitTest\BowlingAppUnitTest.csproj", "{F9B12DFD-EF58-429F-9344-70DFC10EC6E5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BowlingStub", "BowlingStub\BowlingStub.csproj", "{8A978511-1AD6-47BE-A241-07A4E8BA8C0A}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU -- 2.36.3 From 3753cc54e137c69cae575090cf8ec4e8f89abd4d Mon Sep 17 00:00:00 2001 From: victor perez ngounou Date: Wed, 28 Sep 2022 11:36:39 +0200 Subject: [PATCH 12/24] Update Stub --- Sources/BowlingStub/BowlingStub.csproj | 4 ++++ Sources/BowlingStub/StubEquipe.cs | 6 ++++-- Sources/BowlingStub/StubJoueur.cs | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Sources/BowlingStub/BowlingStub.csproj b/Sources/BowlingStub/BowlingStub.csproj index 132c02c..88ad13a 100644 --- a/Sources/BowlingStub/BowlingStub.csproj +++ b/Sources/BowlingStub/BowlingStub.csproj @@ -6,4 +6,8 @@ enable + + + + diff --git a/Sources/BowlingStub/StubEquipe.cs b/Sources/BowlingStub/StubEquipe.cs index ae8f036..4a76c4e 100644 --- a/Sources/BowlingStub/StubEquipe.cs +++ b/Sources/BowlingStub/StubEquipe.cs @@ -1,3 +1,4 @@ +using BowlingLib.Model; using System; public class StubEquipe @@ -11,7 +12,7 @@ public class StubEquipe { for (int i = 0; i < n; i++) { - listEquipes.Add(new Equipe() { Nom = "Equipe " + i + 1 }); + listEquipes.Add(new Equipe("Equipe " + i + 1)); for(int k = 0; k < j; k++) { @@ -19,6 +20,7 @@ public class StubEquipe } } - } + return listEquipes; + } } diff --git a/Sources/BowlingStub/StubJoueur.cs b/Sources/BowlingStub/StubJoueur.cs index 9a8ad90..5fc7ec1 100644 --- a/Sources/BowlingStub/StubJoueur.cs +++ b/Sources/BowlingStub/StubJoueur.cs @@ -1,4 +1,5 @@ -using System; +using BowlingLib.Model; +using System; public class StubJoueur { @@ -11,8 +12,9 @@ private List listJoueurs = new List(); { for (int i = 0; i < n; i++) { - listJoueurs.Add(new Joueur() { Pseudo = "Joueur "+i+1 }); + listJoueurs.Add(new Joueur("Joueur " + i + 1)); } + return listJoueurs; } } -- 2.36.3 From 8b829d57ff3951d149477f28461896a4e42fd011 Mon Sep 17 00:00:00 2001 From: victor perez ngounou Date: Wed, 28 Sep 2022 11:38:32 +0200 Subject: [PATCH 13/24] Update test Project --- Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj b/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj index 73961d6..bb6074e 100644 --- a/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj +++ b/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj @@ -21,5 +21,6 @@ + -- 2.36.3 From 043401dba4b8cee51f45b21da77e277799984737 Mon Sep 17 00:00:00 2001 From: Arafamamadouelaphi <92931011+Arafamamadouelaphi@users.noreply.github.com> Date: Wed, 28 Sep 2022 10:51:22 +0100 Subject: [PATCH 14/24] Creation de test pour la classe Equipe --- .../Tests/BowlingAppUnitTest/testequipe.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Sources/Tests/BowlingAppUnitTest/testequipe.cs diff --git a/Sources/Tests/BowlingAppUnitTest/testequipe.cs b/Sources/Tests/BowlingAppUnitTest/testequipe.cs new file mode 100644 index 0000000..63de4e3 --- /dev/null +++ b/Sources/Tests/BowlingAppUnitTest/testequipe.cs @@ -0,0 +1,30 @@ +using BowlingLib.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace BowlingAppUnitTest +{ + public class TestEquipe + { + [Fact] + public void testConstructeur() + { + Equipe p = new Equipe("sao"); + Assert.NotNull("p"); + Assert.Equal(p.Nom, "sao"); + Assert.NotEqual(p.Nom, "sao"); + + } + [Fact] + public void TestInvalideEquipe() + { + Assert.Throws(() => new Equipe(null)); + } + + + } +} -- 2.36.3 From 63a4515565d1b445be429258976f8ce4b203f449 Mon Sep 17 00:00:00 2001 From: Victor Perez NGOUNOU Date: Thu, 29 Sep 2022 08:24:40 +0000 Subject: [PATCH 15/24] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Sources/Test?= =?UTF-8?q?s/BowlingAppUnitTest/BowlingAppUnitTest.csproj'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BowlingAppUnitTest.csproj | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj b/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj index bb6074e..13f9b25 100644 --- a/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj +++ b/Sources/Tests/BowlingAppUnitTest/BowlingAppUnitTest.csproj @@ -1,26 +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 + + + + + + + -- 2.36.3 From aee02a15d3868e3c652fda0d491f25214797031b Mon Sep 17 00:00:00 2001 From: Victor Perez NGOUNOU Date: Thu, 29 Sep 2022 08:26:28 +0000 Subject: [PATCH 16/24] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Sources/Test?= =?UTF-8?q?s/BowlingAppUnitTest/UnitTestJoueur.cs'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tests/BowlingAppUnitTest/UnitTestJoueur.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs index b346d82..e4e1be0 100644 --- a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs +++ b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs @@ -22,15 +22,15 @@ namespace Test.BowlingAppUnitTest } [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")]; + [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 ) { -- 2.36.3 From 2860ff75165a2187e7922580562b48b4c8276794 Mon Sep 17 00:00:00 2001 From: Augustin AFFOGNON Date: Thu, 29 Sep 2022 08:50:43 +0000 Subject: [PATCH 17/24] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Sources/Test?= =?UTF-8?q?s/BowlingAppUnitTest/UnitTestJoueur.cs'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs index e4e1be0..1e904b9 100644 --- a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs +++ b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs @@ -6,10 +6,10 @@ namespace Test.BowlingAppUnitTest { public class UnitTestJoueur { + Joueur j = new Joueur("Paul"); [Fact] public void TestConstructeur() - { - Joueur j = new Joueur("Paul"); + { Assert.NotNull(j); Assert.Equal(j.Pseudo, "Paul"); Assert.NotEqual(j.Pseudo, "joel"); -- 2.36.3 From 3112216572587bd05483df157a6824e9520cf98d Mon Sep 17 00:00:00 2001 From: Augustin AFFOGNON Date: Thu, 29 Sep 2022 08:59:35 +0000 Subject: [PATCH 18/24] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Sources/Test?= =?UTF-8?q?s/BowlingAppUnitTest/UnitTestJoueur.cs'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs index 1e904b9..cecec70 100644 --- a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs +++ b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs @@ -11,8 +11,8 @@ namespace Test.BowlingAppUnitTest public void TestConstructeur() { Assert.NotNull(j); - Assert.Equal(j.Pseudo, "Paul"); - Assert.NotEqual(j.Pseudo, "joel"); + Assert.Equal( "Paul",j.Pseudo); + Assert.NotEqual("joel",j.Pseudo ); } [Fact] -- 2.36.3 From 507963153355b7ab05b338d77953b4a3a15e028a Mon Sep 17 00:00:00 2001 From: Augustin AFFOGNON Date: Thu, 29 Sep 2022 09:02:53 +0000 Subject: [PATCH 19/24] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Sources/Test?= =?UTF-8?q?s/BowlingAppUnitTest/UnitTestJoueur.cs'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs index cecec70..508c2c6 100644 --- a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs +++ b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs @@ -42,7 +42,7 @@ namespace Test.BowlingAppUnitTest return; Joueur j = new Joueur(pseudo); - Assert.Equal(pseudo, j.Pseudo); + Assert.Equal(expectedPseudo, j.Pseudo); } } } -- 2.36.3 From 507f56f2140ac04d5710458b5c2a13e8e7dc9e9e Mon Sep 17 00:00:00 2001 From: Augustin AFFOGNON Date: Thu, 29 Sep 2022 09:05:21 +0000 Subject: [PATCH 20/24] Ajouter 'Sources/BowlingLib/Model/Equipe.cs' --- Sources/BowlingLib/Model/Equipe.cs | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Sources/BowlingLib/Model/Equipe.cs diff --git a/Sources/BowlingLib/Model/Equipe.cs b/Sources/BowlingLib/Model/Equipe.cs new file mode 100644 index 0000000..a9f67d9 --- /dev/null +++ b/Sources/BowlingLib/Model/Equipe.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BowlingLib.Model +{ + public class Equipe + { + private string nom; + private List joueurs; + + public string Nom + { + get { return nom; } + set { nom = value; } + } + + public List Joueurs + { + get { return joueurs; } + set { joueurs = value; } + } + + public Equipe(string nom) + { + this.nom = nom; + joueurs = new List(); + } + + public void AjouterJoueur(Joueur joueur) + { + joueurs.Add(joueur); + } + + public void SupprimerJoueur(Joueur joueur) + { + joueurs.Remove(joueur); + } + + //retourner la liste non modifiable des joueurs de l'équipe + public List GetJoueurs() + { + return joueurs.AsReadOnly().ToList(); + } + } +} -- 2.36.3 From 0407d22840e1f60f23a2679fba8b00d84754ec4d Mon Sep 17 00:00:00 2001 From: Augustin AFFOGNON Date: Thu, 29 Sep 2022 09:14:48 +0000 Subject: [PATCH 21/24] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Sources/Test?= =?UTF-8?q?s/BowlingAppUnitTest/UnitTestJoueur.cs'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs index 508c2c6..9cdcbd2 100644 --- a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs +++ b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs @@ -22,7 +22,7 @@ namespace Test.BowlingAppUnitTest } [Theory] - [InlineData(false,"Augustin","Augustinn")] + // [InlineData(false,"Augustin","Augustinn")] [InlineData(true,"Amir","Amir")] [InlineData(false,"Amir","")] [InlineData(false,"Amir",null)] @@ -36,6 +36,7 @@ namespace Test.BowlingAppUnitTest { if (!isValid) { + Assert.Throws( () => new Joueur(pseudo) ); @@ -44,6 +45,7 @@ namespace Test.BowlingAppUnitTest Joueur j = new Joueur(pseudo); Assert.Equal(expectedPseudo, j.Pseudo); } + } } } -- 2.36.3 From 0b5ea00e06cc5bc265d514b213b7715c8de41873 Mon Sep 17 00:00:00 2001 From: Augustin AFFOGNON Date: Thu, 29 Sep 2022 09:22:37 +0000 Subject: [PATCH 22/24] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Sources/Test?= =?UTF-8?q?s/BowlingAppUnitTest/UnitTestJoueur.cs'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs index 9cdcbd2..3d735d3 100644 --- a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs +++ b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs @@ -35,16 +35,15 @@ namespace Test.BowlingAppUnitTest 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); - } + } } -- 2.36.3 From 28a963226c8a59e6e51f345eca878092b5bca615 Mon Sep 17 00:00:00 2001 From: Augustin AFFOGNON Date: Thu, 29 Sep 2022 09:22:52 +0000 Subject: [PATCH 23/24] Supprimer 'Sources/Tests/BowlingAppUnitTest/testequipe.cs' --- .../Tests/BowlingAppUnitTest/testequipe.cs | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 Sources/Tests/BowlingAppUnitTest/testequipe.cs diff --git a/Sources/Tests/BowlingAppUnitTest/testequipe.cs b/Sources/Tests/BowlingAppUnitTest/testequipe.cs deleted file mode 100644 index 63de4e3..0000000 --- a/Sources/Tests/BowlingAppUnitTest/testequipe.cs +++ /dev/null @@ -1,30 +0,0 @@ -using BowlingLib.Model; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Xunit; - -namespace BowlingAppUnitTest -{ - public class TestEquipe - { - [Fact] - public void testConstructeur() - { - Equipe p = new Equipe("sao"); - Assert.NotNull("p"); - Assert.Equal(p.Nom, "sao"); - Assert.NotEqual(p.Nom, "sao"); - - } - [Fact] - public void TestInvalideEquipe() - { - Assert.Throws(() => new Equipe(null)); - } - - - } -} -- 2.36.3 From efcf943763129f913728a1cc003b041879281c2b Mon Sep 17 00:00:00 2001 From: vpngounou Date: Thu, 29 Sep 2022 12:01:33 +0200 Subject: [PATCH 24/24] . --- Sources/Solution.sln | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Solution.sln b/Sources/Solution.sln index 9c9621b..5078181 100644 --- a/Sources/Solution.sln +++ b/Sources/Solution.sln @@ -31,10 +31,10 @@ Global {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Debug|Any CPU.Build.0 = Debug|Any CPU {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Release|Any CPU.ActiveCfg = Release|Any CPU {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Release|Any CPU.Build.0 = Release|Any CPU - {8A978511-1AD6-47BE-A241-07A4E8BA8C0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A978511-1AD6-47BE-A241-07A4E8BA8C0A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8A978511-1AD6-47BE-A241-07A4E8BA8C0A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8A978511-1AD6-47BE-A241-07A4E8BA8C0A}.Release|Any CPU.Build.0 = Release|Any CPU + {B50615A5-ABFD-4A9C-B236-DBAEDE62AB2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B50615A5-ABFD-4A9C-B236-DBAEDE62AB2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B50615A5-ABFD-4A9C-B236-DBAEDE62AB2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B50615A5-ABFD-4A9C-B236-DBAEDE62AB2E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- 2.36.3