Tests/Identity.Api.Tests/Controllers/UsersControllerTests.cs
/// <summary>
/// Given null request
/// When creating user
/// Return bad request
/// </summary>
Given null request
When creating user
Return bad request
Given null request When creating user Return bad request
[Fact]
        public async Task CreateUserAsync_NullRequest_ReturnBadRequest()
        {
            UserCreationRequest request = null;
            BadRequestObjectResult result = await _usersController.CreateUserAsync(request).ConfigureAwait(false)
                as BadRequestObjectResult;
            Assert.NotNull(result);
            ResultMessage objectResult = result.Value as ResultMessage;
            Assert.False(objectResult.OperationStatus);
            Assert.Equal(MessageResources.UserCreationRequestEmpty, objectResult.ErrorMessages.First());
        }
[ Fact ] public async Task CreateUserAsync_NullRequest_ReturnBadRequest ( ) { UserCreationRequest request = null ; BadRequestObjectResult result = await _usersController . CreateUserAsync ( request ) . ConfigureAwait ( false ) as BadRequestObjectResult ; Assert . NotNull ( result ) ; ResultMessage objectResult = result . Value as ResultMessage ; Assert . False ( objectResult . OperationStatus ) ; Assert . Equal ( MessageResources . UserCreationRequestEmpty , objectResult . ErrorMessages . First ( ) ) ; }
Given null request
When creating user
Return bad request
Given null request When creating user Return bad request
// Arrange // Act // Assert