Ejemplo n.º 1
0
            public async void Should_return_ok_with_success()
            {
                // Arrange
                var genre = new Genre
                {
                    Name = "Marshmellow Man"
                };
                var result = new Result();

                UpdateGenreCommandMock
                .Setup(x => x.Execute(genre))
                .ReturnsAsync(result);

                // Act
                var serviceResult = await ServiceUnderTest.UpdateGenreAsync(genre);

                Assert.Same(result, serviceResult);
                Assert.True(serviceResult.IsSuccess);
            }
Ejemplo n.º 2
0
            public async void Should_return_error_with_message()
            {
                // Arrange
                var genre = new Genre
                {
                    Name = "Peter Piper"
                };
                var result = new Result();

                result.AddError("no thank you");
                UpdateGenreCommandMock
                .Setup(x => x.Execute(genre))
                .ReturnsAsync(result);

                // Act
                var serviceResult = await ServiceUnderTest.UpdateGenreAsync(genre);

                // Assert
                Assert.Same(result, serviceResult);
                Assert.NotEmpty(serviceResult.Errors);
                Assert.False(serviceResult.IsSuccess);
            }