public IActionResult Update(string id, Heroes heroesIn) { var heroes = _heroesService.Get(id); if (heroes == null) { return(NotFound()); } _heroesService.Update(id, heroesIn); return(NoContent()); }
public void Update_ShouldReplaceSpecifiedHero_WhenHeroPassed() { HeroesService heroesService = new HeroesService(); Hero hero = new Hero() { Id = 5, Name = "kyle", Pic = "https://images2.minutemediacdn.com/image/upload/c_crop,h_1180,w_2100,x_0,y_94/f_auto,q_auto,w_1100/v1555001162/shape/mentalfloss/504106-wikipedia.jpg", Power = 0.7 }; heroesService.Update(hero); Assert.AreEqual(0.7, heroesService.GetHeroes().Last().Power); }
public void update_hero() { HeroesService heroes = new HeroesService(); Hero hero = new Hero() { Id = 4, Name = "Dale", Pic = "https://images2.minutemediacdn.com/image/upload/c_crop,h_1180,w_2100,x_0,y_94/f_auto,q_auto,w_1100/v1555001162/shape/mentalfloss/504106-wikipedia.jpg", Power = 3 }; heroes.Update(hero); Assert.AreEqual(3, heroes.GetById(4).Power); //update Heroes[Test] }