public async void Delete_NotExistingIdPassed_ReturnsNotFoundResponse()
        {
            //Arrange
            var notExistingNumber = 999;

            //Act
            var badResponse = await characterController.Delete(notExistingNumber);

            //Assert
            Assert.IsType <NotFoundResult>(badResponse.Result);
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }