public void Delete_ShouldReturnNotFound_WhenUnknownIdPassed() { int id = 20; ActionResult res = controller.Delete(id); Assert.IsType <NotFoundResult>(res); }
public async Task get_status_not_found_deleting_a_non_existent_hero() { var hero = new Hero() { Id = Guid.NewGuid() }; var repository = Substitute.For <IHeroesRepository>(); repository.GetByIdAsync(hero.Id).Returns((Hero)null); var herosController = new HeroesController(repository); var result = await herosController.Delete(hero.Id); (result as NotFoundResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound); }