You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
764 B
37 lines
764 B
using apiLOL;
|
|
using apiLOL.Controllers;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using StubLib;
|
|
|
|
namespace TestUnitaire
|
|
{
|
|
public class TestAPILol
|
|
{
|
|
[Fact]
|
|
public void Test1()
|
|
{
|
|
|
|
}
|
|
|
|
[Fact]
|
|
public void TestPostChampion()
|
|
{
|
|
// Arrange
|
|
var data = new StubData();
|
|
var controller = new ControllerChampions(new StubData());
|
|
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<int> nbItemTask = nbItem;
|
|
|
|
// Assert
|
|
Assert.IsType<OkResult>(result);
|
|
// Verify that the champions is added to the stub
|
|
Assert.Equal(7, nbItemTask.Result);
|
|
|
|
}
|
|
}
|
|
} |