diff --git a/ProjectUnitaire/TestUnit.cs b/ProjectUnitaire/TestUnit.cs
deleted file mode 100644
index c3ffdcb..0000000
--- a/ProjectUnitaire/TestUnit.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using TheGameExtreme.model;
-using TheGameExtreme.model.manager;
-using TheGameExtreme.viewmodel;
-
-namespace ProjectUnitaire
-{
- [TestClass]
- public class TestUnit
- {
- [TestMethod]
- public void EndTurnTest()
- {
-
- }
- }
-}
diff --git a/TestUnit/TestUnit.csproj b/TestUnit/TestUnit.csproj
new file mode 100644
index 0000000..36979d1
--- /dev/null
+++ b/TestUnit/TestUnit.csproj
@@ -0,0 +1,22 @@
+
+
+
+ netcoreapp3.0
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TestUnit/UnitTest1.cs b/TestUnit/UnitTest1.cs
new file mode 100644
index 0000000..df59c19
--- /dev/null
+++ b/TestUnit/UnitTest1.cs
@@ -0,0 +1,11 @@
+namespace TestUnit
+{
+ [TestClass]
+ public class UnitTest1
+ {
+ [TestMethod]
+ public void TestMethod1()
+ {
+ }
+ }
+}
diff --git a/TestUnitaire/AppInitializer.cs b/TestUnitaire/AppInitializer.cs
index a787b93..0c00000 100644
--- a/TestUnitaire/AppInitializer.cs
+++ b/TestUnitaire/AppInitializer.cs
@@ -9,7 +9,7 @@ namespace TestUnitaire
{
public class AppInitializer
{
- public static IApp StartApp(Platform platform)
+ /*public static IApp StartApp(Platform platform)
{
// TODO: If the iOS or Android app being tested is included in the solution
// then open the Unit Tests window, right click Test Apps, select Add App Project
@@ -38,6 +38,6 @@ namespace TestUnitaire
// code if the app is not included in the solution.
//.AppBundle ("../../../iOS/bin/iPhoneSimulator/Debug/XamarinForms.iOS.app")
.StartApp();
- }
+ }*/
}
}
diff --git a/TheGameExtreme.Android/Resources/Resource.designer.cs b/TheGameExtreme.Android/Resources/Resource.designer.cs
index 38335a6..2254765 100644
--- a/TheGameExtreme.Android/Resources/Resource.designer.cs
+++ b/TheGameExtreme.Android/Resources/Resource.designer.cs
@@ -1,11 +1,11 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
+// Ce code a été généré par un outil.
+// Version du runtime :4.0.30319.42000
//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
+// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
+// le code est régénéré.
//
//------------------------------------------------------------------------------
diff --git a/TheGameExtreme.sln b/TheGameExtreme.sln
index e78b001..0701b18 100644
--- a/TheGameExtreme.sln
+++ b/TheGameExtreme.sln
@@ -10,7 +10,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheGameExtreme", "TheGameEx
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestUnitaire", "TestUnitaire\TestUnitaire.csproj", "{DAB0A3A0-CD99-4819-A813-01F10D77BAB1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectUnitaire", "ProjectUnitaire\ProjectUnitaire.csproj", "{FA55654F-097D-4E83-809E-A2C7E46563A4}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProjectGame", "UnitTestProjectGame\UnitTestProjectGame.csproj", "{4092C852-D253-42F7-A800-E618C99C349E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -70,18 +70,18 @@ Global
{DAB0A3A0-CD99-4819-A813-01F10D77BAB1}.Release|iPhone.Build.0 = Release|Any CPU
{DAB0A3A0-CD99-4819-A813-01F10D77BAB1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{DAB0A3A0-CD99-4819-A813-01F10D77BAB1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|iPhone.ActiveCfg = Debug|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|iPhone.Build.0 = Debug|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|Any CPU.Build.0 = Release|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|iPhone.ActiveCfg = Release|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|iPhone.Build.0 = Release|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Release|iPhone.Build.0 = Release|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {4092C852-D253-42F7-A800-E618C99C349E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/TheGameExtreme/model/manager/SoloGameManager.cs b/TheGameExtreme/model/manager/SoloGameManager.cs
index f6fd159..3b0f346 100644
--- a/TheGameExtreme/model/manager/SoloGameManager.cs
+++ b/TheGameExtreme/model/manager/SoloGameManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using TheGameExtreme.model.card;
using TheGameExtreme.model.@event;
diff --git a/TheGameExtreme/model/manager/SoloGameManager.cs.orig b/TheGameExtreme/model/manager/SoloGameManager.cs.orig
new file mode 100644
index 0000000..5751b62
--- /dev/null
+++ b/TheGameExtreme/model/manager/SoloGameManager.cs.orig
@@ -0,0 +1,164 @@
+using System;
+using System.Collections.Generic;
+using TheGameExtreme.model.card;
+using TheGameExtreme.model.@event;
+
+namespace TheGameExtreme.model.manager
+{
+ public class SoloGameManager : GameManager
+ {
+
+ public SoloGameManager(int nbPlayer, List players)
+ : base(nbPlayer, players)
+ {
+
+ }
+
+ public override bool endTurn()
+ {
+<<<<<<< HEAD
+ verifyNbCardPlay();
+
+=======
+ // Vérifie que l'utilisateur a bien joué deux cartes
+>>>>>>> c1e072686aecc6833e1faf062739820e55484d86
+ pioche();
+
+ currentIndexPlayer += 1;
+ if (currentIndexPlayer == playerList.Count)
+ {
+ currentIndexPlayer = 0;
+ }
+ CurrentHand = playerList[currentIndexPlayer].getCardList();
+ OnPlayerChanged(new PlayerChangedEventArgs(CurrentHand));
+ nbCardAtBeginOfTurn = CurrentHand.Count;
+ CurrentCardPlayed.Clear();
+
+ if (isEndGame()) // Ajouter le score en calculant les cartes restantes dans la pile et dans les mains des joueurs
+ {
+ displayWinner();
+ return true;
+ }
+
+ return false;
+ }
+
+ protected void verifyNbCardPlay()
+ {
+ foreach (Card cardPlayed in CurrentCardPlayed)
+ {
+ if (cardPlayed.GetType() == typeof(ThreeCard))
+ {
+ if ((nbCardAtBeginOfTurn - CurrentHand.Count) < 3) // Penser à vérifier s'il a joué une ThreeCard pour regarder s'il a bien joué 3 cartes
+ {
+ testIsEndGame();
+ }
+ return;
+ }
+ }
+ if ((nbCardAtBeginOfTurn - CurrentHand.Count) < 2) // Penser à vérifier s'il a joué une ThreeCard pour regarder s'il a bien joué 3 cartes
+ {
+ testIsEndGame();
+ }
+ }
+
+ protected void testIsEndGame()
+ {
+ if (isEndGame())
+ {
+ displayWinner();
+ }
+ else
+ {
+ throw new Exception("Vous n'avez pas joué assez de carte!");
+ }
+ }
+
+ protected void displayWinner()
+ {
+ if (win)
+ {
+ EndMessage = "Le jeu est terminé!\n Bravo vous avez gagné!";
+ }
+ }
+
+ protected override void pioche()
+ {
+ int nbPickedCard = nbMaxCard - CurrentHand.Count;
+ for (int i = 0; i < nbPickedCard; i++)
+ {
+ if (deck.Count == 0)
+ {
+ return;
+ }
+ int random = new Random().Next(0, deck.Count - 1);
+ playerList[currentIndexPlayer].pioche(deck[random]);
+ deck.RemoveAt(random);
+ }
+ }
+
+ protected override bool isEndGame()
+ {
+ if (CurrentHand.Count != 0)
+ {
+ List playableCard = new List();
+ tryToFindSoluce(playableCard);
+ return testEndGame(playableCard);
+ }
+ return false;
+ }
+
+ protected override void tryToFindSoluce(List playableCard)
+ {
+ CurrentHand.ForEach(card =>
+ {
+ if (card.Value > ListOrderedStacks[0].Peek().Value || card.Value > ListOrderedStacks[1].Peek().Value || card.Value < ListOrderedStacks[2].Peek().Value || card.Value < ListOrderedStacks[3].Peek().Value)
+ {
+ playableCard.Add(card);
+ }
+ });
+ }
+
+ protected override bool testEndGame(List playableCard)
+ {
+ if (playableCard.Count == 2)
+ {
+ foreach (Card c in playableCard)
+ {
+ if (c.Equals(typeof(ThreeCard)))
+ {
+ win = false;
+ EndMessage = "Le jeu est terminé!\n Désolé, vous avez perdu... Vous deviez jouer trois cartes à cause de l'effet \"Trois cartes joué\" hors votre jeu ne permet pas d'en jouer autant! Essayez encore!";
+ return true;
+ }
+ }
+ }
+ else if (playableCard.Count < 2)
+ {
+ win = false;
+ EndMessage = "Le jeu est terminé!\n Désolé, vous avez perdu... Essayez encore!";
+ return true;
+ }
+ else if (effectLose())
+ {
+ win = false;
+ EndMessage = "Désolé, vous n'avez pas recouvert la tête de mort... Réessayez ;)";
+ return true;
+ }
+
+ return false;
+ }
+
+ protected override bool effectLose()
+ {
+ foreach (Stack orderedStack in ListOrderedStacks)
+ {
+ if (orderedStack.Peek().GetType() == typeof(EndGameCard))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+}
diff --git a/ProjectUnitaire/Properties/AssemblyInfo.cs b/UnitTestProjectGame/Properties/AssemblyInfo.cs
similarity index 75%
rename from ProjectUnitaire/Properties/AssemblyInfo.cs
rename to UnitTestProjectGame/Properties/AssemblyInfo.cs
index 9cc3533..1fab91b 100644
--- a/ProjectUnitaire/Properties/AssemblyInfo.cs
+++ b/UnitTestProjectGame/Properties/AssemblyInfo.cs
@@ -2,18 +2,18 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-[assembly: AssemblyTitle("ProjectUnitaire")]
+[assembly: AssemblyTitle("UnitTestProjectGame")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ProjectUnitaire")]
+[assembly: AssemblyProduct("UnitTestProjectGame")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
-[assembly: Guid("fa55654f-097d-4e83-809e-a2c7e46563a4")]
+[assembly: Guid("4092c852-d253-42f7-a800-e618c99c349e")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/UnitTestProjectGame/UnitTest1.cs b/UnitTestProjectGame/UnitTest1.cs
new file mode 100644
index 0000000..bdd984b
--- /dev/null
+++ b/UnitTestProjectGame/UnitTest1.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using TheGameExtreme.model;
+using TheGameExtreme.model.manager;
+using TheGameExtreme.viewmodel;
+
+namespace UnitTestProjectGame
+{
+ [TestClass]
+ public class UnitTest1
+ {
+ GameManager g1 = new SoloGameManager(2, new List { "clement", " baptiste" });
+ [TestMethod]
+ public void JoueTest()
+ {
+ object expectedRes = null;
+ int valueCard = 89;
+ int orderedStackSelected = 3;
+
+ g1.joue(valueCard, orderedStackSelected);
+ Assert.AreEqual(expectedRes, null);
+ }
+
+ [TestMethod]
+ public void isCanPlayTest()
+ {
+ List currentHhand = new List();
+ bool valeur;
+ bool expected1 = true;
+ bool expected2 = false;
+ g1.isCanPlay();
+
+
+ if(g1.isCanPlay() == true)
+ {
+ valeur = true;
+ Assert.AreEqual(expected1, valeur);
+ }
+ /*else
+ {
+ //Exception à gérer//
+ }*/
+
+ if(g1.isCanPlay() == false)
+ {
+ valeur = false;
+ Assert.Equals(expected2, valeur);
+ }
+ else
+ {
+ //Exception à gérer//
+ }
+ }
+
+ [TestMethod]
+ public void EndTurnTest()
+ {
+ object expectedRes = null;
+
+ g1.endTurn();
+ Assert.AreEqual(expectedRes, null);
+ }
+
+ [TestMethod]
+ public void getCurentIndexPlayerTest()
+ {
+
+ }
+ }
+}
diff --git a/ProjectUnitaire/ProjectUnitaire.csproj b/UnitTestProjectGame/UnitTestProjectGame.csproj
similarity index 94%
rename from ProjectUnitaire/ProjectUnitaire.csproj
rename to UnitTestProjectGame/UnitTestProjectGame.csproj
index f07c934..044fe6d 100644
--- a/ProjectUnitaire/ProjectUnitaire.csproj
+++ b/UnitTestProjectGame/UnitTestProjectGame.csproj
@@ -5,11 +5,11 @@
Debug
AnyCPU
- {FA55654F-097D-4E83-809E-A2C7E46563A4}
+ {4092C852-D253-42F7-A800-E618C99C349E}
Library
Properties
- ProjectUnitaire
- ProjectUnitaire
+ UnitTestProjectGame
+ UnitTestProjectGame
v4.7.2
512
{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
@@ -49,7 +49,7 @@
-
+
@@ -57,7 +57,7 @@
- {8de6c881-ff77-4cc4-b8c4-cdedd9ab13b3}
+ {8DE6C881-FF77-4CC4-B8C4-CDEDD9AB13B3}
TheGameExtreme
diff --git a/ProjectUnitaire/packages.config b/UnitTestProjectGame/packages.config
similarity index 100%
rename from ProjectUnitaire/packages.config
rename to UnitTestProjectGame/packages.config