pull/64/head
Arafamamadouelaphi 3 years ago committed by victor perez ngounou
parent 8f6b6f383c
commit 24c633622b

@ -65,7 +65,7 @@ namespace BowlingMaping
/// recupère tous les joueurs de la Base de données
/// </summary>
/// <returns></returns>
public async Task< IEnumerable<Joueur> >GetAll()
public async Task<IEnumerable<Joueur>> GetAll()
{
using (var context = new BowlingContext())
{

@ -133,6 +133,7 @@ namespace BowlingMaping
List<Partie> result = new List<Partie>();
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)

@ -13,7 +13,7 @@ namespace BowlingStub
}
public bool Add(Equipe data)
public async Task<bool> Add(Equipe data)
{
if (data != null)
{
@ -23,7 +23,7 @@ namespace BowlingStub
return false;
}
public bool Delete(Equipe data)
public async Task<bool> Delete(Equipe data)
{
if (data != null)
{
@ -48,7 +48,7 @@ namespace BowlingStub
}
public IEnumerable<Equipe> GetAll()
public async Task<IEnumerable<Equipe>> GetAll()
{
Load();
return listEquipes;
@ -56,7 +56,7 @@ namespace BowlingStub
//mise à jour d'une équipe
public bool Update(Equipe data)
public async Task<bool> Update(Equipe data)
{
if (data != null)
{
@ -70,12 +70,12 @@ namespace BowlingStub
}
public Equipe GetDataWithName(string name)
public async Task<Equipe> GetDataWithName(string name)
{
throw new NotImplementedException();
}
public IEnumerable<Equipe> GetAllWithDate(DateTime date)
public async Task<IEnumerable<Equipe>> GetAllWithDate(DateTime date)
{
throw new NotImplementedException();
}

@ -10,7 +10,7 @@ namespace BowlingStub
private List<Joueur> listJoueurs = new List<Joueur>();
public bool Add(Joueur data)
public async Task<bool> Add(Joueur data)
{
if (data != null)
{
@ -20,22 +20,22 @@ namespace BowlingStub
return false;
}
public bool Delete(Joueur data)
public async Task<bool> Delete(Joueur data)
{
if (data != null)
{
listJoueurs.Remove(data);
return true;
return true;
}
return false;
}
public IEnumerable<Joueur> GetAll()
public async Task<IEnumerable<Joueur>> GetAll()
{
return listJoueurs;
}
//n represente le nbr de joueurs a creer dans la liste
public IEnumerable<Joueur> GetAllJoueur(int n = 10)
public async Task<IEnumerable<Joueur> >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 Task<Joueur >GetDataWithId (int id)
{
throw new NotImplementedException();
}
public Joueur GetDataWithName(string name)
public async Task<Joueur> GetDataWithName(string name)
{
throw new NotImplementedException();
}//
public bool Update(Joueur data)
public async Task<bool> Update(Joueur data)
{
if (data != null)
{

@ -7,7 +7,7 @@ namespace BowlingStub
{
private List<Partie> listParties = new List<Partie>();
public bool Add(Partie data)
public async Task<bool> Add(Partie data)
{
if (data != null)
{
@ -17,7 +17,7 @@ namespace BowlingStub
return false;
}
public bool Delete(Partie data)
public async Task<bool> Delete(Partie data)
{
if (data != null)
{
@ -27,7 +27,7 @@ namespace BowlingStub
return false;
}
public IEnumerable<Partie> GetAll()
public async Task<IEnumerable<Partie>> GetAll()
{
return listParties;
}
@ -42,22 +42,22 @@ namespace BowlingStub
}
//GDW?
public Partie GetDataWithId(int id)
public async Task<Partie> GetDataWithId(int id)
{
throw new NotImplementedException();
}
public Partie GetDataWithName(string name)
public async Task<Partie> GetDataWithName(string name)
{
throw new NotImplementedException();
}
public bool Update(Partie data)
public async Task<bool> 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;

@ -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());
//}
}
}

Loading…
Cancel
Save