using Api_lol.Controllers; using DTO; using Microsoft.AspNetCore.Mvc; using StubLib; using System.Net.Http.Json; using System.Reflection; namespace TestUnitaireApi { public class TestChampions { StubData stubChamps; Champions controlleurChampion; public TestChampions() { this.stubChamps = new StubData(); this.controlleurChampion = new Champions(null,stubChamps); } [Fact] public async Task TestGetChampions() { var liste = await controlleurChampion.Get(); OkObjectResult tmp = liste as OkObjectResult; if (tmp == null) { Assert.Fail("Liste okObject == null"); return; } IEnumerable listeChamp = tmp.Value as IEnumerable; if (listeChamp == null) { Assert.Fail("Liste champ == null"); return; } Assert.Equal(6,listeChamp.Count()); } } }