diff --git a/Sources/BowlingEF/BowlingEF.csproj b/Sources/BowlingEF/BowlingEF.csproj
new file mode 100644
index 0000000..132c02c
--- /dev/null
+++ b/Sources/BowlingEF/BowlingEF.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/Sources/BowlingEF/Class1.cs b/Sources/BowlingEF/Class1.cs
new file mode 100644
index 0000000..a9cb237
--- /dev/null
+++ b/Sources/BowlingEF/Class1.cs
@@ -0,0 +1,7 @@
+namespace BowlingEF
+{
+ public class Class1
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/Sources/BowlingEF/Entities/EquipeEntity.cs b/Sources/BowlingEF/Entities/EquipeEntity.cs
new file mode 100644
index 0000000..44a6789
--- /dev/null
+++ b/Sources/BowlingEF/Entities/EquipeEntity.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BowlingEF.Entities
+{
+ //classe EquipeEntity représentant la table Equipe de la base de données
+ public class EquipeEntity
+ {
+ public long Id { get; set; }
+ public string Nom { get; set; }
+ public List Joueurs { get; set; }
+ public EquipeEntity()
+ {
+ Joueurs = new List();
+ }
+ }
+}
diff --git a/Sources/BowlingEF/Entities/JoueurEntity.cs b/Sources/BowlingEF/Entities/JoueurEntity.cs
new file mode 100644
index 0000000..1fdffdc
--- /dev/null
+++ b/Sources/BowlingEF/Entities/JoueurEntity.cs
@@ -0,0 +1,6 @@
+namespace BowlingEF.Entities
+{
+ public class JoueurEntity
+ {
+ }
+}
\ No newline at end of file
diff --git a/Sources/BowlingLib/Model/Equipe.cs b/Sources/BowlingLib/Model/Equipe.cs
index f7d3a1b..c68504b 100644
--- a/Sources/BowlingLib/Model/Equipe.cs
+++ b/Sources/BowlingLib/Model/Equipe.cs
@@ -5,13 +5,13 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.Collections.ObjectModel;
namespace BowlingLib.Model
{
public class Equipe
{
private string nom;
+ private readonly long id;
public List Joueurs = new List();
@@ -32,7 +32,10 @@ namespace BowlingLib.Model
// foreach (Joueur nouv in joueurs) AjouterJoueur(nouv);
}
- public object Id { get; set; }
+ public long Id
+ {
+ get { return id; }
+ }
private int numero;
diff --git a/Sources/BowlingLib/Model/FacadeManager.cs b/Sources/BowlingLib/Model/FacadeManager.cs
deleted file mode 100644
index fe21397..0000000
--- a/Sources/BowlingLib/Model/FacadeManager.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-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/BowlingLib/Model/Frame.cs b/Sources/BowlingLib/Model/Frame.cs
index 52030e5..31dee99 100644
--- a/Sources/BowlingLib/Model/Frame.cs
+++ b/Sources/BowlingLib/Model/Frame.cs
@@ -21,6 +21,12 @@ namespace BowlingLib.Model
}
private int numero;
+ private long id;
+ public long Id
+ {
+ get { return id; }
+ }
+
public int QuillesRestantes
{ get
diff --git a/Sources/BowlingLib/Model/Joueur.cs b/Sources/BowlingLib/Model/Joueur.cs
index d74045c..8b10c71 100644
--- a/Sources/BowlingLib/Model/Joueur.cs
+++ b/Sources/BowlingLib/Model/Joueur.cs
@@ -9,6 +9,11 @@ namespace BowlingLib.Model
public class Joueur
{
private string pseudo;
+ private readonly long id;
+ public long Id
+ {
+ get { return id; }
+ }
public Joueur(string pseudo)
{
@@ -35,6 +40,10 @@ namespace BowlingLib.Model
pseudo == joueur.pseudo &&
Pseudo == joueur.Pseudo;
}
- public int Id { get; set; }
+
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(pseudo, id, Id, Pseudo);
+ }
}
}
diff --git a/Sources/BowlingLib/Model/Manager.cs b/Sources/BowlingLib/Model/Manager.cs
deleted file mode 100644
index 74d06b4..0000000
--- a/Sources/BowlingLib/Model/Manager.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-using BowlingLib.Interface;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BowlingLib.Model
-{
- public class Manager
- {
- public IDataManager joueurManager { get; private set; }
- public IDataManager partieManager { get; private set; }
- public IDataManager equipeManager { get; private set; }
-
- public Manager(IDataManager joueurManager)
- {
- this.joueurManager = joueurManager;
- }
-
- public Manager(IDataManager partieManager)
- {
- this.partieManager = partieManager;
- }
-
- ///
- /// Ajoute un joueur à la liste des joueurs
- ///
- ///
- public Manager(IDataManager equipeManager)
- {
- this.equipeManager = equipeManager;
- }
-
- ///
- /// Ajoute un joueur à la liste des joueurs
- ///
- ///
- public void AddJoueur(Joueur joueur)
- {
- joueurManager.Add(joueur);
- }
-
- ///
- /// Ajoute une partie à la liste des parties
- ///
- ///
- public void AddPartie(Partie partie)
- {
- partieManager.Add(partie);
- }
-
- ///
- /// Ajoute une équipe à la liste des équipes
- ///
- ///
- public void AddEquipe(Equipe equipe)
- {
- equipeManager.Add(equipe);
- }
-
- ///
- /// Retourne la liste des joueurs
- ///
- ///
- public void DeleteJoueur(Joueur joueur)
- {
- joueurManager.Delete(joueur);
- }
-
- ///
- /// Supprime une partie
- ///
- ///
- public void DeletePartie(Partie partie)
- {
- partieManager.Delete(partie);
- }
-
- ///
- /// Supprime une équipe
- ///
- ///
- public void DeleteEquipe(Equipe equipe)
- {
- equipeManager.Delete(equipe);
- }
-
- ///
- /// Retourne la liste des joueurs
- ///
- ///
- public void UpdateJoueur(Joueur joueur)
- {
- joueurManager.Update(joueur);
- }
-
- ///
- /// Met à jour une partie
- ///
- ///
- public void UpdatePartie(Partie partie)
- {
- partieManager.Update(partie);
- }
-
- ///
- /// Met à jour une équipe
- ///
- ///
- public void UpdateEquipe(Equipe equipe)
- {
- equipeManager.Update(equipe);
- }
-
- ///
- /// Retourne la liste des joueurs
- ///
- ///
- public IEnumerable GetAllJoueur()
- {
- return joueurManager.GetAll();
- }
-
- ///
- /// Retourne les dernières parties du joueur
- ///
- ///
- public IEnumerable GetAllPartie()
- {
- return partieManager.GetAll();
- }
-
- ///
- /// Retourne les Equipe d'une partie
- ///
- ///
- public IEnumerable GetAllEquipe()
- {
- return equipeManager.GetAll();
- }
-
-
-
-
- }
-}
diff --git a/Sources/BowlingLib/Model/Partie.cs b/Sources/BowlingLib/Model/Partie.cs
index c24b567..dd82583 100644
--- a/Sources/BowlingLib/Model/Partie.cs
+++ b/Sources/BowlingLib/Model/Partie.cs
@@ -11,7 +11,8 @@ namespace BowlingLib.Model
{
//public ReadOnlyCollection Frames;
public Joueur Joueur { get; private set; }
- public object Id { get; set; }
+ private readonly long id;
+ public long Id => id;
public List Frames;
diff --git a/Sources/BowlingStub/BowlingStub.csproj b/Sources/BowlingStub/BowlingStub.csproj
index 88ad13a..00f86ed 100644
--- a/Sources/BowlingStub/BowlingStub.csproj
+++ b/Sources/BowlingStub/BowlingStub.csproj
@@ -8,6 +8,7 @@
+
diff --git a/Sources/BowlingStub/StubEquipe.cs b/Sources/BowlingStub/StubEquipe.cs
index a9e3e12..a820696 100644
--- a/Sources/BowlingStub/StubEquipe.cs
+++ b/Sources/BowlingStub/StubEquipe.cs
@@ -1,7 +1,7 @@
-using BowlingLib.Model;
-using BowlingLib.Interface;
-using System;
-
+using BowlingLib.Model;
+using Business;
+using System;
+
namespace BowlingStub
{
public class StubEquipe : IDataManager
@@ -9,16 +9,29 @@ namespace BowlingStub
private List listEquipes = new List();
public StubEquipe()
{
+ //listEquipes.Add(new Equipe("Equipe 1", new Joueur("Joueur 1"), new Joueur("Joueur 2")));
+ //listEquipes.Add(new Equipe("Equipe 2", new Joueur("Joueur 3"), new Joueur("Joueur 4")));
+ //listEquipes.Add(new Equipe("Equipe 3", new Joueur("Joueur 5"), new Joueur("Joueur 6")));
}
- public void Add(Equipe data)
+ public bool Add(Equipe data)
{
- listEquipes.Add(data);
+ if (data != null)
+ {
+ listEquipes.Add(data);
+ return true;
+ }
+ return false;
}
- public void Delete(Equipe data)
+ public bool Delete(Equipe data)
{
- listEquipes.Remove(data);
+ if (data != null)
+ {
+ listEquipes.Remove(data);
+ return true;
+ }
+ return false;
}
public IEnumerable GetAll(int n = 10, int j = 2)
@@ -41,12 +54,29 @@ namespace BowlingStub
return listEquipes;
}
+
//mise à jour d'une équipe
- public void Update(Equipe data)
+ public bool Update(Equipe data)
{
- int index = listEquipes.FindIndex(x => x.Id == data.Id);
- listEquipes[index] = data;
+ if (data != null)
+ {
+ int index = listEquipes.FindIndex(x => x.Id == data.Id);
+ listEquipes[index] = data;
+ return true;
+ }
+ return false;
+
+
}
- }
+ public Equipe GetDataWithId(int id)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Equipe GetDataWithName(string name)
+ {
+ throw new NotImplementedException();
+ }
+ }
}
\ No newline at end of file
diff --git a/Sources/BowlingStub/StubJoueur.cs b/Sources/BowlingStub/StubJoueur.cs
index da5ffad..b6ee50d 100644
--- a/Sources/BowlingStub/StubJoueur.cs
+++ b/Sources/BowlingStub/StubJoueur.cs
@@ -1,5 +1,5 @@
using BowlingLib.Model;
-using BowlingLib.Interface;
+using Business;
using System;
namespace BowlingStub
@@ -10,14 +10,24 @@ namespace BowlingStub
private List listJoueurs = new List();
- public void Add(Joueur data)
+ public bool Add(Joueur data)
{
- listJoueurs.Add(data);
+ if (data != null)
+ {
+ listJoueurs.Add(data);
+ return true;
+ }
+ return false;
}
- public void Delete(Joueur data)
+ public bool Delete(Joueur data)
{
- listJoueurs.Remove(data);
+ if (data != null)
+ {
+ listJoueurs.Remove(data);
+ return true;
+ }
+ return false;
}
public IEnumerable GetAll()
@@ -34,10 +44,26 @@ namespace BowlingStub
return listJoueurs;
}
- public void Update(Joueur data)
+ public Joueur GetDataWithId(int id)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Joueur GetDataWithName(string name)
{
- int index = listJoueurs.FindIndex(x => x.Id == data.Id);
- listJoueurs[index] = data;
+ throw new NotImplementedException();
+ }
+
+ public bool Update(Joueur data)
+ {
+ if (data != null)
+ {
+
+ int index = listJoueurs.FindIndex(x => x.Id == data.Id);
+ listJoueurs[index] = data;
+ return true;
+ }
+ return false;
}
}
diff --git a/Sources/BowlingStub/StubManager.cs b/Sources/BowlingStub/StubManager.cs
index 5edfb1c..167bff7 100644
--- a/Sources/BowlingStub/StubManager.cs
+++ b/Sources/BowlingStub/StubManager.cs
@@ -1,4 +1,5 @@
using BowlingLib.Model;
+using Business;
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/Sources/BowlingStub/StubPartie.cs b/Sources/BowlingStub/StubPartie.cs
index 9e0651c..417bd16 100644
--- a/Sources/BowlingStub/StubPartie.cs
+++ b/Sources/BowlingStub/StubPartie.cs
@@ -1,5 +1,5 @@
using BowlingLib.Model;
-using BowlingLib.Interface;
+using Business;
namespace BowlingStub
{
@@ -7,14 +7,24 @@ namespace BowlingStub
{
private List listParties = new List();
- public void Add(Partie data)
+ public bool Add(Partie data)
{
- listParties.Add(data);
+ if (data != null)
+ {
+ listParties.Add(data);
+ return true;
+ }
+ return false;
}
- public void Delete(Partie data)
+ public bool Delete(Partie data)
{
- listParties.Remove(data);
+ if (data != null)
+ {
+ listParties.Remove(data);
+ return true;
+ }
+ return false;
}
public IEnumerable GetAll()
@@ -31,10 +41,25 @@ namespace BowlingStub
return listParties;
}
- public void Update(Partie data)
+ public Partie GetDataWithId(int id)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Partie GetDataWithName(string name)
{
- int index = listParties.FindIndex(x => x.Id == data.Id);
- listParties[index] = data;
+ throw new NotImplementedException();
+ }
+
+ public bool Update(Partie data)
+ {
+ if (data != null)
+ {
+
+ int index = listParties.FindIndex(x => x.Id == data.Id);
+ listParties[index] = data;
+ }
+ return false;
}
}
diff --git a/Sources/Business/Business.csproj b/Sources/Business/Business.csproj
new file mode 100644
index 0000000..88ad13a
--- /dev/null
+++ b/Sources/Business/Business.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/Sources/BowlingLib/Interface/IDataManager.cs b/Sources/Business/IDataManager.cs
similarity index 59%
rename from Sources/BowlingLib/Interface/IDataManager.cs
rename to Sources/Business/IDataManager.cs
index b509d9b..3ceeae9 100644
--- a/Sources/BowlingLib/Interface/IDataManager.cs
+++ b/Sources/Business/IDataManager.cs
@@ -5,13 +5,15 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BowlingLib.Interface
+namespace Business
{
public interface IDataManager
{
- void Add(Data data);
- void Delete(Data data);
- void Update(Data data);
+ bool Add(Data data);
+ bool Delete(Data data);
+ bool Update(Data data);
+ Data GetDataWithId(int id);
+ Data GetDataWithName(string name);
IEnumerable GetAll();
IEnumerable GetAll(int n, int j);
}
diff --git a/Sources/Business/Manager.cs b/Sources/Business/Manager.cs
new file mode 100644
index 0000000..7de4c4f
--- /dev/null
+++ b/Sources/Business/Manager.cs
@@ -0,0 +1,214 @@
+using BowlingLib.Model;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Business
+{
+ public class Manager
+ {
+ public ReadOnlyCollection Parties { get; private set; }
+ private readonly List parties = new();
+ public ReadOnlyCollection Equipes { get; private set; }
+ private readonly List equipes = new();
+ public ReadOnlyCollection Joueurs { get; private set; }
+ private readonly List joueurs = new();
+
+
+ public IDataManager JoueurDataManager => joueurDataManager;
+ private readonly IDataManager joueurDataManager;
+ public IDataManager PartieDataManager => partieDataManager;
+ private readonly IDataManager partieDataManager;
+ public IDataManager EquipeDataManager => equipeDataManager;
+ private readonly IDataManager equipeDataManager;
+
+ public Manager(IDataManager joueurManager)
+ {
+ this.joueurDataManager = joueurManager;
+ Joueurs = new ReadOnlyCollection(joueurs);
+
+ }
+
+ public Manager(IDataManager partieDataManager)
+ {
+ this.partieDataManager = partieDataManager;
+ Parties = new ReadOnlyCollection(parties);
+ }
+
+
+ public Manager(IDataManager equipeDataManager)
+ {
+ this.equipeDataManager = equipeDataManager;
+ Equipes = new ReadOnlyCollection(equipes);
+ }
+
+ ///
+ /// Ajoute un joueur à la liste des joueurs
+ ///
+ ///
+ ///
+ public bool AddJoueur(Joueur joueur)
+ {
+ if (joueurDataManager == null)
+ {
+ return false;
+ }
+ return joueurDataManager.Add(joueur);
+ }
+
+ ///
+ /// Ajoute une partie à la liste des parties
+ ///
+ ///
+ ///
+ public bool AddPartie(Partie partie)
+ {
+ if (partieDataManager == null)
+ {
+ return false;
+ }
+ return partieDataManager.Add(partie);
+ }
+
+ ///
+ /// Ajoute une équipe à la liste des équipes
+ ///
+ ///
+ ///
+ public bool AddEquipe(Equipe equipe)
+ {
+ if (equipeDataManager == null)
+ {
+ return false;
+ }
+ return equipeDataManager.Add(equipe);
+ }
+
+ ///
+ /// Retourne la liste des joueurs
+ ///
+ ///
+ public bool DeleteJoueur(Joueur joueur)
+ {
+ if (joueurDataManager == null)
+ {
+ return false;
+ }
+ return JoueurDataManager.Delete(joueur);
+ }
+
+ ///
+ /// Supprime une partie
+ ///
+ ///
+ public bool DeletePartie(Partie partie)
+ {
+ if (partieDataManager == null)
+ {
+ return false;
+ }
+ return partieDataManager.Delete(partie);
+ }
+
+ ///
+ /// Supprime une équipe
+ ///
+ ///
+ public bool DeleteEquipe(Equipe equipe)
+ {
+ if (equipeDataManager == null)
+ {
+ return false;
+ }
+ return equipeDataManager.Delete(equipe);
+ }
+
+ ///
+ /// Retourne la liste des joueurs
+ ///
+ ///
+ public bool UpdateJoueur(Joueur joueur)
+ {
+ if (joueurDataManager == null)
+ {
+ return false;
+ }
+ return JoueurDataManager.Update(joueur);
+ }
+
+ ///
+ /// Met à jour une partie
+ ///
+ ///
+ public bool UpdatePartie(Partie partie)
+ {
+ if (partieDataManager == null)
+ {
+ return false;
+ }
+ return partieDataManager.Update(partie);
+ }
+
+ ///
+ /// Met à jour une équipe
+ ///
+ ///
+ public bool UpdateEquipe(Equipe equipe)
+ {
+ if (equipeDataManager == null)
+ {
+ return false;
+ }
+ return equipeDataManager.Update(equipe);
+ }
+
+ ///
+ /// Retourne la liste des joueurs
+ ///
+ ///
+ public IEnumerable GetAllJoueur()
+ {
+ return JoueurDataManager.GetAll();
+ }
+
+ ///
+ /// Retourne les dernières parties du joueur
+ ///
+ ///
+ public IEnumerable GetAllPartie()
+ {
+ return partieDataManager.GetAll();
+ }
+
+ ///
+ /// Retourne les Equipe en fonction d'une partie
+ ///
+ ///
+ public IEnumerable GetAllEquipe()
+ {
+ return equipeDataManager.GetAll();
+ }
+
+ //retourne le joueur avec l'id
+ public Joueur GetJoueurWithId(int id)
+ {
+ return JoueurDataManager.GetDataWithId(id);
+ }
+
+ //retourne la partie avec l'id
+ public Partie GetPartieWithId(int id)
+ {
+ return partieDataManager.GetDataWithId(id);
+ }
+
+ //retourne l'équipe avec l'id
+ public Equipe GetEquipeWithId(int id)
+ {
+ return equipeDataManager.GetDataWithId(id);
+ }
+
+ }
+}
diff --git a/Sources/Solution.sln b/Sources/Solution.sln
index 5078181..52c5fe7 100644
--- a/Sources/Solution.sln
+++ b/Sources/Solution.sln
@@ -13,6 +13,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BowlingAppUnitTest", "Tests
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BowlingStub", "BowlingStub\BowlingStub.csproj", "{B50615A5-ABFD-4A9C-B236-DBAEDE62AB2E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Business", "Business\Business.csproj", "{4F0C1B08-1DB7-4424-9521-EB13A858D09B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BowlingEF", "BowlingEF\BowlingEF.csproj", "{1E42224B-45E4-433C-9D20-0A61023790ED}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -35,6 +39,14 @@ Global
{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
+ {4F0C1B08-1DB7-4424-9521-EB13A858D09B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4F0C1B08-1DB7-4424-9521-EB13A858D09B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4F0C1B08-1DB7-4424-9521-EB13A858D09B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4F0C1B08-1DB7-4424-9521-EB13A858D09B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1E42224B-45E4-433C-9D20-0A61023790ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1E42224B-45E4-433C-9D20-0A61023790ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1E42224B-45E4-433C-9D20-0A61023790ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1E42224B-45E4-433C-9D20-0A61023790ED}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Sources/Tests/BowlingAppUnitTest/UTManager.cs b/Sources/Tests/BowlingAppUnitTest/UTManager.cs
index 2d628a6..7142db8 100644
--- a/Sources/Tests/BowlingAppUnitTest/UTManager.cs
+++ b/Sources/Tests/BowlingAppUnitTest/UTManager.cs
@@ -1,5 +1,6 @@
using BowlingLib.Model;
using BowlingStub;
+using Business;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -23,7 +24,7 @@ namespace BowlingAppUnitTest
manager.AddJoueur(joueur);
//Assert
- Assert.Single(manager.joueurManager.GetAll());
+ Assert.Single(manager.JoueurDataManager.GetAll());
}
//Test de la méthode AddPartie
@@ -38,7 +39,7 @@ namespace BowlingAppUnitTest
manager.AddPartie(partie);
//Assert
- Assert.Single(manager.partieManager.GetAll());
+ Assert.Single(manager.PartieDataManager.GetAll());
}
//Test de la méthode AddEquipe
diff --git a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs
index 2187c69..1003aa8 100644
--- a/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs
+++ b/Sources/Tests/BowlingAppUnitTest/UnitTestJoueur.cs
@@ -1,111 +1,111 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using BowlingLib.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using BowlingLib.Model;
using BowlingStub;
-using Xunit;
-
-namespace Test.BowlingAppUnitTest
-{
- public class UnitTestJoueur
- {
- Joueur j = new Joueur("Paul");
- [Fact]
- public void TestConstructeur()
- {
- Assert.NotNull(j);
- Assert.Equal("Paul", j.Pseudo);
- Assert.NotEqual("joel", j.Pseudo);
- }
-
- [Fact]
- public void TestInvalidJoueur()
- {
- Assert.Throws(() => new Joueur(null));
- }
-
- [Theory]
- [InlineData(true, false, "Augustin", "Augustinn", false)]
- [InlineData(true, true, "Amir", "Amir", true)]
- [InlineData(false, false, "Amir", "", false)]
- [InlineData(false, false, "Amir", null, false)]
- [InlineData(false, false, null, null, true)]
- [InlineData(false, false, null, "", false)]
- [InlineData(false, false, "", null, false)]
- [InlineData(false, false, "", "", true)]
- [InlineData(false, false, "f2", "f2", true)]
- public void TestContructeur(bool isFormated, bool isValid, string expectedPseudo, String pseudo, bool isEqual)
- {
- if (!isValid && !isFormated)
- {
- Assert.Throws(
- () => new Joueur(pseudo)
- );
- return;
- }
-
- Joueur j = new Joueur(pseudo);
-
-
- if (!isEqual)
- {
- Assert.NotEqual(expectedPseudo, j.Pseudo);
-
- }
- else
- {
-
-
- if (!isEqual)
- {
- Assert.NotEqual(expectedPseudo, j.Pseudo);
-
- }
- else
- {
- Assert.Equal(expectedPseudo, j.Pseudo);
-
- }
-
-
- }
-
- }
-
- //Test joueur avec stub
- [Fact]
- public void TestJoueurStub()
- {
- StubJoueur stub = new StubJoueur();
- Assert.Equal(10, stub.GetAll(10).Count());
- }
-
-
- //tester la methode remove
- [Fact]
- public void TestRemove()
- {
- StubJoueur stub = new StubJoueur();
- stub.Add(j);
- stub.Delete(j);
- //Compter le nombre de joueur dans un objet IEnumerable
- Assert.Equal(0, stub.GetAll().Count());
- }
-
-
- [Fact]
- public void TestUpdate()
- {
- StubJoueur stub = new StubJoueur();
- Joueur j = new Joueur("Paul");
- stub.Add(j);
- j.Pseudo = "Augustin";
- stub.Update(j);
- Assert.Equal("Augustin", stub.GetAll().First().Pseudo);
- }
-
-
-
-
- }
-}
+using Xunit;
+
+namespace Test.BowlingAppUnitTest
+{
+ public class UnitTestJoueur
+ {
+ Joueur j = new Joueur("Paul");
+ [Fact]
+ public void TestConstructeur()
+ {
+ Assert.NotNull(j);
+ Assert.Equal("Paul", j.Pseudo);
+ Assert.NotEqual("joel", j.Pseudo);
+ }
+
+ [Fact]
+ public void TestInvalidJoueur()
+ {
+ Assert.Throws(() => new Joueur(null));
+ }
+
+ [Theory]
+ [InlineData(true, false, "Augustin", "Augustinn", false)]
+ [InlineData(true, true, "Amir", "Amir", true)]
+ [InlineData(false, false, "Amir", "", false)]
+ [InlineData(false, false, "Amir", null, false)]
+ [InlineData(false, false, null, null, true)]
+ [InlineData(false, false, null, "", false)]
+ [InlineData(false, false, "", null, false)]
+ [InlineData(false, false, "", "", true)]
+ [InlineData(false, false, "f2", "f2", true)]
+ public void TestContructeur(bool isFormated, bool isValid, string expectedPseudo, String pseudo, bool isEqual)
+ {
+ if (!isValid && !isFormated)
+ {
+ Assert.Throws(
+ () => new Joueur(pseudo)
+ );
+ return;
+ }
+
+ Joueur j = new Joueur(pseudo);
+
+
+ if (!isEqual)
+ {
+ Assert.NotEqual(expectedPseudo, j.Pseudo);
+
+ }
+ else
+ {
+
+
+ if (!isEqual)
+ {
+ Assert.NotEqual(expectedPseudo, j.Pseudo);
+
+ }
+ else
+ {
+ Assert.Equal(expectedPseudo, j.Pseudo);
+
+ }
+
+
+ }
+
+ }
+
+ //Test joueur avec stub
+ [Fact]
+ public void TestJoueurStub()
+ {
+ StubJoueur stub = new StubJoueur();
+ Assert.Equal(10, stub.GetAll(10).Count());
+ }
+
+
+ //tester la methode remove
+ [Fact]
+ public void TestRemove()
+ {
+ StubJoueur stub = new StubJoueur();
+ stub.Add(j);
+ stub.Delete(j);
+ //Compter le nombre de joueur dans un objet IEnumerable
+ Assert.Equal(0, stub.GetAll().Count());
+ }
+
+
+ [Fact]
+ public void TestUpdate()
+ {
+ StubJoueur stub = new StubJoueur();
+ Joueur j = new Joueur("Paul");
+ stub.Add(j);
+ j.Pseudo = "Augustin";
+ stub.Update(j);
+ Assert.Equal("Augustin", stub.GetAll().First().Pseudo);
+ }
+
+
+
+
+ }
+}