Beispiel #1
0
        public void Remove_ShouldRemoveSpecifiedHero_WhenExistingIdPassed()
        {
            HeroesService heroesService = new HeroesService();

            heroesService.Remove(5);

            Assert.AreEqual(4, heroesService.GetHeroes().Count());
        }
        public void remove_hero()
        {
            HeroesService heroes   = new HeroesService();
            List <Hero>   heroList = heroes.GetHeroes().ToList();
            int           n        = heroList.Count();

            foreach (Hero h in heroList)
            {
                heroes.Remove(h.Id);
            }

            Assert.AreEqual(0, heroes.GetHeroes().Count());
        }
Beispiel #3
0
        public IActionResult Delete(string id)
        {
            var heroes = _heroesService.Get(id);

            if (heroes == null)
            {
                return(NotFound());
            }

            _heroesService.Remove(heroes.Id);

            return(NoContent());
        }