예제 #1
0
        public void GetById_ShouldReturnNull_WhenUnknownIdPassed()
        {
            HeroesService heroesService = new HeroesService();

            Hero hero = heroesService.GetById(5000);

            Assert.IsNull(hero);
        }
예제 #2
0
        public void GetById_ShouldReturnSpecifiedHero_WhenExisitingIdPassed()
        {
            HeroesService heroesService = new HeroesService();

            Hero hero = heroesService.GetById(1);

            Assert.AreEqual("Pasha", hero.Name);
        }
예제 #3
0
 public ActionResult <Hero> GetAll(int id)
 {
     try
     {
         return(Ok(_service.GetById(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
        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]
        }