|
|
@ -17,14 +17,20 @@ namespace TestUnitaireAPiLol
|
|
|
|
public void TestPostChampion()
|
|
|
|
public void TestPostChampion()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Arrange
|
|
|
|
// Arrange
|
|
|
|
|
|
|
|
var data = new StubData();
|
|
|
|
var controller = new ControllerChampions(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
|
|
|
|
// Act
|
|
|
|
var result = controller.Post(champDTO);
|
|
|
|
var result = controller.Post(champDTO);
|
|
|
|
|
|
|
|
data.ChampionsMgr.AddItem(champDTO.ToModel());
|
|
|
|
|
|
|
|
var nbItem = data.ChampionsMgr.GetNbItems();
|
|
|
|
|
|
|
|
Task<int> nbItemTask = nbItem;
|
|
|
|
|
|
|
|
|
|
|
|
// Assert
|
|
|
|
// Assert
|
|
|
|
Assert.IsType<OkResult>(result);
|
|
|
|
Assert.IsType<OkResult>(result);
|
|
|
|
|
|
|
|
// Verify that the champions is added to the stub
|
|
|
|
|
|
|
|
Assert.Equal(7, nbItemTask.Result);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|