Esempio n. 1
0
            public async void Should_return_ok_with_success()
            {
                // Arrange
                var Nationality = new Nationality
                {
                    Name = "Peter Piper"
                };
                var result = new Result();

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

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

                // Assert
                Assert.Same(result, serviceResult);
                Assert.True(serviceResult.IsSuccess);
            }
Esempio n. 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");
                AddNationalityCommandMock
                .Setup(x => x.Execute(Nationality))
                .ReturnsAsync(result);

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

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