From 62e23ce9246984fde1470a491ef5e1f7b720a6b9 Mon Sep 17 00:00:00 2001 From: nathan boileau Date: Thu, 2 Feb 2023 11:59:45 +0100 Subject: [PATCH] test unitaire post --- Sources/TestUnitaireAPiLol/UnitTest1.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Sources/TestUnitaireAPiLol/UnitTest1.cs b/Sources/TestUnitaireAPiLol/UnitTest1.cs index 28eaee6..ab3973d 100644 --- a/Sources/TestUnitaireAPiLol/UnitTest1.cs +++ b/Sources/TestUnitaireAPiLol/UnitTest1.cs @@ -10,22 +10,28 @@ namespace TestUnitaireAPiLol [Fact] public void Test1() { - + } [Fact] public void TestPostChampion() { // Arrange + var data = new StubData(); var controller = new ControllerChampions(new StubData()); - var champDTO = new ChampionDTO("Charle", "Charle est un champion de League of Legends"); + var champDTO = new ChampionDTO("Charles", "Charles est un champion de League of Legends"); // Act var result = controller.Post(champDTO); + data.ChampionsMgr.AddItem(champDTO.ToModel()); + var nbItem = data.ChampionsMgr.GetNbItems(); + Task nbItemTask = nbItem; // Assert Assert.IsType(result); - + // Verify that the champions is added to the stub + Assert.Equal(7, nbItemTask.Result); + } } } \ No newline at end of file