Post fix no more 🐛

pull/29/head
Corentin R 2 years ago
parent 3b2cfba59b
commit 8a58b97d0b

@ -139,7 +139,7 @@ namespace API_LoL.Controllers
else
{
var champ = await ChampionsManager.GetItemsByName(champion.Name, 0, 1);
if(champ.FirstOrDefault().Name == champion.Name)
if(champ.Count() != 0 && champ.FirstOrDefault().Name == champion.Name)
{
return Conflict(champion);
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -76,9 +76,11 @@ namespace Api_UT
{
ChampionsController api = new ChampionsController(new StubData());
IActionResult a = await api.Post(new ChampionDTO("nom","bio","icon", "Assassin",""));
var action = (CreatedAtActionResult)a;
var champAction = action.Value as IEnumerable<ChampionDTO>;
Assert.IsNotNull(a);
ChampionDTO champ = new ChampionDTO("nom", "bio", "icon","Assassin", "");
Assert.IsTrue(champ.equals((ChampionDTO)((CreatedAtActionResult)a).Value));
Assert.IsTrue(champ.equals(other: (ChampionDTO)((CreatedAtActionResult)a).Value));
}
}

Loading…
Cancel
Save