diff --git a/Sources/API_LoL/Controllers/ChampionsController.cs b/Sources/API_LoL/Controllers/ChampionsController.cs index b397831..96adf52 100644 --- a/Sources/API_LoL/Controllers/ChampionsController.cs +++ b/Sources/API_LoL/Controllers/ChampionsController.cs @@ -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); } diff --git a/Sources/API_LoL/champion.db b/Sources/API_LoL/champion.db index cfdeed2..9b9ff13 100644 Binary files a/Sources/API_LoL/champion.db and b/Sources/API_LoL/champion.db differ diff --git a/Sources/API_LoL/champion.db-shm b/Sources/API_LoL/champion.db-shm index bc92bf7..679fed4 100644 Binary files a/Sources/API_LoL/champion.db-shm and b/Sources/API_LoL/champion.db-shm differ diff --git a/Sources/API_LoL/champion.db-wal b/Sources/API_LoL/champion.db-wal index 8456db7..82f57bb 100644 Binary files a/Sources/API_LoL/champion.db-wal and b/Sources/API_LoL/champion.db-wal differ diff --git a/Sources/Api_UT/ChampionControllerTest.cs b/Sources/Api_UT/ChampionControllerTest.cs index 787899f..09c7875 100644 --- a/Sources/Api_UT/ChampionControllerTest.cs +++ b/Sources/Api_UT/ChampionControllerTest.cs @@ -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; 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)); } }