using APILOL.Controllers; using APILOL.Mapper; using DTO; using Microsoft.AspNetCore.Mvc; using StubLib; namespace TestUnitaire { [TestClass] public class UnitTestChampion { private readonly ChampionsController controller; private readonly StubData stub; public UnitTestChampion() { stub = new StubData(); controller = new ChampionsController(); } [TestMethod] public async Task TestGet() { var champions = await controller.Get(); var resultObject = champions as OkObjectResult; Assert.IsNotNull(resultObject); var resultType = resultObject?.Value as IEnumerable; Assert.IsNotNull(resultType); Assert.AreEqual(resultType.Count(), await stub.ChampionsMgr.GetNbItems()); } [TestMethod] public async Task TestPost() { /*var ChampionDtoToTest = new ChampionDTO { Bio= "This champion is a legendary Fox", Name="Foxane"}; var champions = await controller.Post(ChampionDtoToTest); var resultObject = champions as OkObjectResult; Assert.IsNotNull(resultObject); var resultType = resultObject?.Value as IEnumerable; Assert.IsNotNull(resultType); Assert.AreEqual(resultType.Last(), stub.ChampionsMgr.GetItems(-1, await stub.ChampionsMgr.GetNbItems()));*/ } [TestMethod] public void TestPut() { } [TestMethod] public void TestDelete() { } } }