public void Put_ShouldReturnAcceptedResponse_WhenValidModelPassed() { Hero hero = new Hero() { Id = 1, Name = "Pasha", Pic = "https://spng.pngfly.com/20190305/zga/kisspng-t-shirt-dabbing-unicorn-mens-tank-top-dabbing-un-unicorn-dab-sticker-by-ona-maria-acuna-escano-5c7ee36e662318.0101235515518196304184.jpg", Power = 5 }; ActionResult res = controller.Put(hero); Assert.IsType <AcceptedAtActionResult>(res); }
public async Task get_status_not_found_updating_a_non_existent_hero() { var hero = new Hero() { Id = Guid.NewGuid(), Name = "name", Likes = 2, Default = true, AlterEgo = "alter", AvatarUrl = "avaratrurl", AvatarThumbnailUrl = "avaratrurl2" }; var repository = Substitute.For <IHeroesRepository>(); repository.GetByIdAsync(hero.Id).Returns((Hero)null); var herosController = new HeroesController(repository); var result = await herosController.Put(hero); (result as NotFoundResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound); }