|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using API_LoL.Controllers;
|
|
|
|
|
using DTO;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Model;
|
|
|
|
|
using StubLib;
|
|
|
|
@ -15,8 +16,15 @@ namespace Api_UT
|
|
|
|
|
List<ChampionDTO> list = new List<ChampionDTO> {new ChampionDTO("Akali","",""), new ChampionDTO("Aatrox", "", ""), new ChampionDTO("Ahri", "", ""), new ChampionDTO("Akshan", "", ""), new ChampionDTO("Bard", "", ""), new ChampionDTO("Alistar", "", "") };
|
|
|
|
|
ChampionsController api = new ChampionsController(new StubData());
|
|
|
|
|
IActionResult a = await api.Get();
|
|
|
|
|
Assert.IsNotNull(a);
|
|
|
|
|
Assert.AreEqual(list,((OkObjectResult)a).Value);
|
|
|
|
|
|
|
|
|
|
/// utilisation du nuggets fluentAssertion
|
|
|
|
|
//Assert.IsNotNull(a);
|
|
|
|
|
a.Should().NotBeNull();
|
|
|
|
|
//Assert.AreEqual(list,((OkObjectResult)a).Value);
|
|
|
|
|
var aObject = a as OkObjectResult;
|
|
|
|
|
aObject.Should().NotBeNull();
|
|
|
|
|
var championresult = aObject.Value as IEnumerable<ChampionDTO>;
|
|
|
|
|
list.Should().BeEquivalentTo(championresult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|