diff --git a/Sources/CoreLibrary/Partie.cs b/Sources/CoreLibrary/Partie.cs
index caf426b..29cd93e 100644
--- a/Sources/CoreLibrary/Partie.cs
+++ b/Sources/CoreLibrary/Partie.cs
@@ -107,7 +107,7 @@ namespace CoreLibrary
///
/// Liste des noms des robots.
///
- public IEnumerable Robots => joueurs.Where(joueur => joueur.Value).Select(joueur => joueur.Key);
+ public IEnumerable Robots => joueurs.Where(joueur => !joueur.Value).Select(joueur => joueur.Key);
///
/// Indique si la partie est terminée.
diff --git a/Sources/UnitTesting/PartieUT.cs b/Sources/UnitTesting/PartieUT.cs
index 34b6ff4..2d338ce 100644
--- a/Sources/UnitTesting/PartieUT.cs
+++ b/Sources/UnitTesting/PartieUT.cs
@@ -8,6 +8,7 @@ using CoreLibrary.Core;
using CoreLibrary.Joueurs;
using CoreLibrary.Regles;
using CoreLibrary.Evenements;
+using CoreLibrary.Exceptions;
namespace UnitTesting
@@ -252,6 +253,66 @@ namespace UnitTesting
}
}
}
+
+ [Fact]
+ public void TestJoueurConnecteDejaPresent()
+ {
+ IRegles regle = new ReglesClassiques();
+ Partie partie = new Partie(regle);
+
+ bool appelee = false;
+
+ partie.PartieDemanderJoueur += (sender, e) => {
+ appelee = true;
+
+ if (e.Indice == 1)
+ e.JoueurDemande.SeConnecter(new Joueur("Céleste"));
+ else
+ Assert.Throws(() => e.JoueurDemande.SeConnecter(new Joueur("Céleste")));
+ };
+
+ partie.Jouer();
+
+ Assert.True(appelee);
+ }
+
+ [Fact]
+ public void TestJoueurConnecteNomInterdit()
+ {
+ IRegles regle = new ReglesClassiques();
+ Partie partie = new Partie(regle);
+
+ bool appelee = false;
+
+ partie.PartieDemanderJoueur += (sender, e) => {
+ appelee = true;
+
+ Assert.Throws(() => e.JoueurDemande.SeConnecter(new Joueur("Robot")));
+ };
+
+ partie.Jouer();
+
+ Assert.True(appelee);
+ }
+
+ [Fact]
+ public void TestRobot()
+ {
+ IRegles regle = new ReglesClassiques();
+ Partie partie = new Partie(regle);
+
+ Assert.NotNull(partie.Robots);
+ Assert.Empty(partie.Robots);
+
+ partie.PartieDemanderJoueur += (sender, e) => {
+ e.JoueurDemande.SeConnecter(new Robot());
+ };
+
+ partie.Jouer();
+
+ Assert.NotEmpty(partie.Robots);
+ }
+
[Fact]
public void TestDebutPartie()
{