Tests/Identity.Api.Tests/Controllers/UsersControllerTests.cs
/// <summary>
/// Given null request
/// When authenticating user
/// Return bad request
/// </summary>
Given null request
When authenticating user
Return bad request
Given null request When authenticating user Return bad request
[Fact]
        public async Task AuthenticateUserAsync_NullRequest_ReturnBadRequest()
        {
            AuthenticationRequest request = null;
            BadRequestObjectResult result = await _usersController.AuthenticateUserAsync(request).ConfigureAwait(false)
                as BadRequestObjectResult;
            Assert.NotNull(result);
            AuthenticationResult authenticationResult = result.Value as AuthenticationResult;
            Assert.False(authenticationResult.OperationStatus);
            Assert.Equal(MessageResources.AuthRequestEmpty, authenticationResult.ErrorMessages.First());
        }
[ Fact ] public async Task AuthenticateUserAsync_NullRequest_ReturnBadRequest ( ) { AuthenticationRequest request = null ; BadRequestObjectResult result = await _usersController . AuthenticateUserAsync ( request ) . ConfigureAwait ( false ) as BadRequestObjectResult ; Assert . NotNull ( result ) ; AuthenticationResult authenticationResult = result . Value as AuthenticationResult ; Assert . False ( authenticationResult . OperationStatus ) ; Assert . Equal ( MessageResources . AuthRequestEmpty , authenticationResult . ErrorMessages . First ( ) ) ; }
Given null request
When authenticating user
Return bad request
Given null request When authenticating user Return bad request
// Arrange // Act // Assert