public async void Delete_NotExistingIdPassed_ReturnsNotFoundResponse() { //Arrange var notExistingNumber = 999; //Act var badResponse = await characterController.Delete(notExistingNumber); //Assert Assert.IsType <NotFoundResult>(badResponse.Result); }
public async Task Delete_given_id_calls_DeleteAsync() { var repository = new Mock <ICharacterRepository>(); var controller = new CharactersController(repository.Object); await controller.Delete(42); repository.Verify(r => r.DeleteAsync(42)); }
public async Task Delete_given_valid_character_returns_NoContent() { var repository = new Mock <ICharacterRepository>(); repository.Setup(r => r.DeleteAsync(42)).ReturnsAsync(true); var controller = new CharactersController(repository.Object); var character = new CharacterUpdateDTO(); var result = await controller.Delete(42); Assert.IsType <NoContentResult>(result); }
public async Task Delete_given_non_existing_character_returns_NotFound() { var repository = new Mock <ICharacterRepository>(); repository.Setup(r => r.DeleteAsync(42)).ReturnsAsync(false); var controller = new CharactersController(repository.Object); var character = new CharacterUpdateDTO(); var result = await controller.Delete(42); Assert.IsType <NotFoundResult>(result); }