예제 #1
0
            public async void Should_return_ok_with_success()
            {
                // Arrange
                var Nationality = new Nationality
                {
                    Name = "Marshmellow Man"
                };
                var result = new Result();

                UpdateNationalityCommandMock
                .Setup(x => x.Execute(Nationality))
                .ReturnsAsync(result);

                // Act
                var serviceResult = await ServiceUnderTest.UpdateNationalityAsync(Nationality);

                Assert.Same(result, serviceResult);
                Assert.True(serviceResult.IsSuccess);
            }
예제 #2
0
            public async void Should_return_error_with_message()
            {
                // Arrange
                var Nationality = new Nationality
                {
                    Name = "Peter Piper"
                };
                var result = new Result();

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

                // Act
                var serviceResult = await ServiceUnderTest.UpdateNationalityAsync(Nationality);

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