Ejemplo n.º 1
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.º 2
0
        public void GetHeroes_ShouldReturnAllHeroes()
        {
            HeroesService heroesService = new HeroesService();

            IEnumerable <Hero> heroes = heroesService.GetHeroes();

            Assert.AreEqual(5, heroes.Count());
        }
Ejemplo n.º 3
0
        public void GenerateId_ShouldReturnNextId()
        {
            HeroesService heroesService = new HeroesService();

            int id = heroesService.GenerateId();

            Assert.AreEqual(id, heroesService.GetHeroes().Last().Id + 1);
        }
Ejemplo n.º 4
0
        public void Remove_ShouldRemoveSpecifiedHero_WhenExistingIdPassed()
        {
            HeroesService heroesService = new HeroesService();

            heroesService.Remove(5);

            Assert.AreEqual(4, heroesService.GetHeroes().Count());
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        public void add_new_hero()
        {
            HeroesService heroes = new HeroesService();

            Hero chris = new Hero();

            chris.Name  = "Chris";
            chris.Pic   = "https://making-the-web.com/sites/default/files/clipart/142014/stick-figure-142014-5551841.jpg";
            chris.Power = 2;

            heroes.Add(chris);

            Hero ashazi = new Hero();

            ashazi.Name  = "Ashazi";
            ashazi.Pic   = "http://clipart-library.com/images/pio5eXK6T.png";
            ashazi.Power = 3;

            heroes.Add(ashazi);

            Hero pasha = new Hero();

            pasha.Name  = "Pasha";
            pasha.Pic   = "https://image.shutterstock.com/image-vector/stick-figure-business-ideas-260nw-220840597.jpg";
            pasha.Power = 4;

            heroes.Add(pasha);

            Hero marcus = new Hero();

            marcus.Name  = "Marcus";
            marcus.Pic   = "https://image.shutterstock.com/image-vector/stick-figure-celebration-cheer-260nw-331595411.jpg";
            marcus.Power = 2;

            heroes.Add(marcus);

            Hero dale = new Hero();

            dale.Name  = "Dale";
            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";
            dale.Power = 5;

            heroes.Add(dale);

            Assert.AreEqual(5, heroes.GetHeroes().Count());
        }
Ejemplo n.º 7
0
        public void Add_AddANewHero_WhenHeroPassed()
        {
            HeroesService heroesService = new HeroesService();

            Hero hero = new Hero()
            {
                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 = 1.5
            };

            int id = heroesService.GenerateId();

            hero.Id = id;
            heroesService.Add(hero);

            Assert.AreEqual(id, heroesService.GetHeroes().Last().Id);
        }
Ejemplo n.º 8
0
        public void HeroesService_ShouldIntializeNewHeroesList()
        {
            HeroesService heroesService = new HeroesService();

            Assert.IsNotNull(heroesService.GetHeroes());
        }
Ejemplo n.º 9
0
 public IEnumerable <Heroe> Get()
 {
     return(hs.GetHeroes());
 }