Ejemplo n.º 1
0
        internal async Task GivenDeleteAsyncWhenDataExistThenDeletesData()
        {
            // Arrange
            mockPlaylistService
            .Setup(_ => _.DeleteAsync(It.IsAny <Guid>()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            // Act
            var result = await playlistController.DeleteAsync(It.IsAny <Guid>());

            // Assert
            mockPlaylistService.VerifyAll();
            Assert.IsType <NoContentResult>(result);
            Assert.Equal((int)HttpStatusCode.NoContent, (result as NoContentResult).StatusCode);
        }
        public async Task GivenDeleteAsyncWhenDataExistThenDeletesData()
        {
            // Arrange
            mockPlaylistService
            .Setup(_ => _.DeleteAsync(It.IsAny <Guid>()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            // Act
            var result = await playlistController.DeleteAsync(It.IsAny <Guid>());

            // Assert
            mockPlaylistService.VerifyAll();
            Assert.That(result, Is.InstanceOf <NoContentResult>());
            Assert.That((result as NoContentResult).StatusCode, Is.EqualTo((int)HttpStatusCode.NoContent));
        }
        public async Task GivenDeleteAsyncWhenDataExistThenDeletesData()
        {
            // Arrange
            mockPlaylistService
            .Setup(_ => _.DeleteAsync(It.IsAny <Guid>()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            // Act
            var result = await playlistController.DeleteAsync(It.IsAny <Guid>());

            // Assert
            mockPlaylistService.VerifyAll();
            result.Should().NotBeNull().And.BeOfType <NoContentResult>();
            (result as NoContentResult).StatusCode.Should().Be((int)HttpStatusCode.NoContent);
        }