Ejemplo n.º 1
0
        public void Remove_ShouldRemoveSpecifiedHero_WhenExistingIdPassed()
        {
            HeroesService heroesService = new HeroesService();

            heroesService.Remove(5);

            Assert.AreEqual(4, heroesService.GetHeroes().Count());
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 3
0
        public IActionResult Delete(string id)
        {
            var heroes = _heroesService.Get(id);

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

            _heroesService.Remove(heroes.Id);

            return(NoContent());
        }