diff --git a/Sources/BowlingMaping/JoueurDbDataManager.cs b/Sources/BowlingMaping/JoueurDbDataManager.cs index fc90c5c..92ab7f2 100644 --- a/Sources/BowlingMaping/JoueurDbDataManager.cs +++ b/Sources/BowlingMaping/JoueurDbDataManager.cs @@ -65,7 +65,7 @@ namespace BowlingMaping /// recupère tous les joueurs de la Base de données /// /// - public async Task< IEnumerable >GetAll() + public async Task> GetAll() { using (var context = new BowlingContext()) { diff --git a/Sources/BowlingMaping/PartieDbDataManager.cs b/Sources/BowlingMaping/PartieDbDataManager.cs index 782f009..4934ccc 100644 --- a/Sources/BowlingMaping/PartieDbDataManager.cs +++ b/Sources/BowlingMaping/PartieDbDataManager.cs @@ -133,6 +133,7 @@ namespace BowlingMaping List result = new List(); using (var context = new BowlingContext()) { + var query = context.Parties.Where(item => item.Date == date); foreach (PartieEntity entity in await context.Parties.ToListAsync()) { if (entity.Date.Date == date.Date) diff --git a/Sources/BowlingStub/StubEquipe.cs b/Sources/BowlingStub/StubEquipe.cs index 565e3e7..52ca6ea 100644 --- a/Sources/BowlingStub/StubEquipe.cs +++ b/Sources/BowlingStub/StubEquipe.cs @@ -13,7 +13,7 @@ namespace BowlingStub } - public bool Add(Equipe data) + public async Task Add(Equipe data) { if (data != null) { @@ -23,7 +23,7 @@ namespace BowlingStub return false; } - public bool Delete(Equipe data) + public async Task Delete(Equipe data) { if (data != null) { @@ -48,7 +48,7 @@ namespace BowlingStub } - public IEnumerable GetAll() + public async Task> GetAll() { Load(); return listEquipes; @@ -56,7 +56,7 @@ namespace BowlingStub //mise à jour d'une équipe - public bool Update(Equipe data) + public async Task Update(Equipe data) { if (data != null) { @@ -70,12 +70,12 @@ namespace BowlingStub } - public Equipe GetDataWithName(string name) + public async Task GetDataWithName(string name) { throw new NotImplementedException(); } - public IEnumerable GetAllWithDate(DateTime date) + public async Task> GetAllWithDate(DateTime date) { throw new NotImplementedException(); } diff --git a/Sources/BowlingStub/StubJoueur.cs b/Sources/BowlingStub/StubJoueur.cs index 72e96fd..89b787f 100644 --- a/Sources/BowlingStub/StubJoueur.cs +++ b/Sources/BowlingStub/StubJoueur.cs @@ -10,7 +10,7 @@ namespace BowlingStub private List listJoueurs = new List(); - public bool Add(Joueur data) + public async Task Add(Joueur data) { if (data != null) { @@ -20,22 +20,22 @@ namespace BowlingStub return false; } - public bool Delete(Joueur data) + public async Task Delete(Joueur data) { if (data != null) { listJoueurs.Remove(data); - return true; + return true; } return false; } - public IEnumerable GetAll() + public async Task> GetAll() { return listJoueurs; } //n represente le nbr de joueurs a creer dans la liste - public IEnumerable GetAllJoueur(int n = 10) + public async Task >GetAllJoueur(int n = 10) { for (int i = 0; i < n; i++) { @@ -44,17 +44,17 @@ namespace BowlingStub return listJoueurs; } ///ged - public Joueur GetDataWithId(int id) + public async TaskGetDataWithId (int id) { throw new NotImplementedException(); } - public Joueur GetDataWithName(string name) + public async Task GetDataWithName(string name) { throw new NotImplementedException(); }// - public bool Update(Joueur data) + public async Task Update(Joueur data) { if (data != null) { diff --git a/Sources/BowlingStub/StubPartie.cs b/Sources/BowlingStub/StubPartie.cs index 9adf8d8..3cb2977 100644 --- a/Sources/BowlingStub/StubPartie.cs +++ b/Sources/BowlingStub/StubPartie.cs @@ -7,7 +7,7 @@ namespace BowlingStub { private List listParties = new List(); - public bool Add(Partie data) + public async Task Add(Partie data) { if (data != null) { @@ -17,7 +17,7 @@ namespace BowlingStub return false; } - public bool Delete(Partie data) + public async Task Delete(Partie data) { if (data != null) { @@ -27,7 +27,7 @@ namespace BowlingStub return false; } - public IEnumerable GetAll() + public async Task> GetAll() { return listParties; } @@ -42,22 +42,22 @@ namespace BowlingStub } //GDW? - public Partie GetDataWithId(int id) + public async Task GetDataWithId(int id) { throw new NotImplementedException(); } - public Partie GetDataWithName(string name) + public async Task GetDataWithName(string name) { throw new NotImplementedException(); } - public bool Update(Partie data) + public async Task Update(Partie data) { if (data != null) { - int index = listParties.FindIndex(x => x.Id == data.Id); + int index = listParties. FindIndex(x => x.Id == data.Id); listParties[index] = data; } return false; diff --git a/Sources/Tests/BowlingAppUnitTest/UTManager.cs b/Sources/Tests/BowlingAppUnitTest/UTManager.cs index 7142db8..78ec9f6 100644 --- a/Sources/Tests/BowlingAppUnitTest/UTManager.cs +++ b/Sources/Tests/BowlingAppUnitTest/UTManager.cs @@ -24,7 +24,7 @@ namespace BowlingAppUnitTest manager.AddJoueur(joueur); //Assert - Assert.Single(manager.JoueurDataManager.GetAll()); + Assert.Single(manager.JoueurDataManager.GetAll().Result); } //Test de la méthode AddPartie @@ -39,25 +39,9 @@ namespace BowlingAppUnitTest manager.AddPartie(partie); //Assert - Assert.Single(manager.PartieDataManager.GetAll()); + Assert.Single(manager.PartieDataManager.GetAll().Result); } - //Test de la méthode AddEquipe - //[Fact] - - //public void TestAddEquipe() //Test de la méthode AddEquipe - //{ - // //Arrange - // Equipe equipe = new Equipe("Equipe 1"); - // Manager manager = new Manager(new StubEquipe()); - - // //Act - // manager.AddEquipe(equipe); - - // //Assert - // Assert.Single(manager.equipeManager.GetAll()); - //} - } }