Tests/Identity.Api.Tests/Controllers/UsersControllerTests.cs
/// <summary>
/// Given not null request
/// and identity service returns a response
/// When updating user password
/// Return ok result
/// </summary>
Given not null request
and identity service returns a response
When updating user password
Return ok result
Given not null request and identity service returns a response When updating user password Return ok result
[Fact]
        public async Task UpdateUserPasswordAsync_NotNullRequest_IdentityServiceReturnsResponse_ReturnOkResult()
        {
            PasswordInitializationRequest request = new PasswordInitializationRequest
            {
                Login = "elbarto",
                NewPassword = "skiner wienner",
                OldPassword = "skinner the old wienner"
            };
            _identityServiceMock.Setup(mock => mock.UpdateUserPasswordAsync(request)).ReturnsAsync(new ResultMessage
            {
                OperationStatus = true
            });
            OkObjectResult result = await _usersController.UpdateUserPasswordAsync(request).ConfigureAwait(false)
                as OkObjectResult;
            Assert.NotNull(result); ;
            ResultMessage authenticationResult = result.Value as ResultMessage;
            Assert.True(authenticationResult.OperationStatus);
        }
[ Fact ] public async Task UpdateUserPasswordAsync_NotNullRequest_IdentityServiceReturnsResponse_ReturnOkResult ( ) { PasswordInitializationRequest request = new PasswordInitializationRequest { Login = " " , NewPassword = " " , OldPassword = " " } ; _identityServiceMock . Setup ( mock => mock . UpdateUserPasswordAsync ( request ) ) . ReturnsAsync ( new ResultMessage { OperationStatus = true } ) ; OkObjectResult result = await _usersController . UpdateUserPasswordAsync ( request ) . ConfigureAwait ( false ) as OkObjectResult ; Assert . NotNull ( result ) ; ; ResultMessage authenticationResult = result . Value as ResultMessage ; Assert . True ( authenticationResult . OperationStatus ) ; }
Given not null request
and identity service returns a response
When updating user password
Return ok result
Given not null request and identity service returns a response When updating user password Return ok result
// Arrange // Act // Assert