Tests/Identity.Api.Tests/Controllers/UsersControllerTests.cs
/// <summary>
/// Given identity service retrieves users successfully
/// When getting all users
/// return user list
/// </summary>
Given identity service retrieves users successfully
When getting all users
return user list
Given identity service retrieves users successfully When getting all users return user list
[Fact]
        public void GetAllUsers_WhenIdentityServiceSucceeds_ReturnUsersListMessage()
        {
            UsersListMessage usersListMessage = new UsersListMessage
            {
                OperationStatus = true,
                Users = new List<UserResult>
                {
                    new UserResult
                    {
                        Login = "nihaw",
                        Email = "nihaw@hotmail.com",
                        CreationDate = DateTime.Now,
                        UpdateDate = DateTime.Now
                    }
                }
            };
            _identityServiceMock.Setup(mock => mock.Users).Returns(usersListMessage);
            OkObjectResult result = _usersController.GetAllUsers() as OkObjectResult;
            Assert.NotNull(result);
            Assert.Equal(usersListMessage, result.Value);
        }
[ Fact ] public void GetAllUsers_WhenIdentityServiceSucceeds_ReturnUsersListMessage ( ) { UsersListMessage usersListMessage = new UsersListMessage { OperationStatus = true , Users = new List < UserResult > { new UserResult { Login = " " , Email = " " , CreationDate = DateTime . Now , UpdateDate = DateTime . Now } } } ; _identityServiceMock . Setup ( mock => mock . Users ) . Returns ( usersListMessage ) ; OkObjectResult result = _usersController . GetAllUsers ( ) as OkObjectResult ; Assert . NotNull ( result ) ; Assert . Equal ( usersListMessage , result . Value ) ; }
Given identity service retrieves users successfully
When getting all users
return user list
Given identity service retrieves users successfully When getting all users return user list
// Arrange // Act // Assert