public void Post_ShouldReturnCreatedResponse_WhenValidModelPasses() { Hero hero = new Hero() { Name = "Jojo", Pic = "", Power = 15 }; ActionResult res = controller.Post(hero); Assert.IsType <CreatedAtActionResult>(res); }
public async Task get_status_bad_request_creating_a_hero_with_no_alterego() { var hero = new Hero() { Id = Guid.NewGuid(), Name = "name", Likes = 2, Default = true, AvatarUrl = "avaratrurl", AvatarThumbnailUrl = "avaratrurl2" }; var repository = Substitute.For <IHeroesRepository>(); var herosController = new HeroesController(repository); var result = await herosController.Post(hero); (result as BadRequestResult).StatusCode.Should().Be((int)HttpStatusCode.BadRequest); }