Tests/Identity.Infrastructure.Tests/Services/IdentityServiceTests.cs
/// <summary>
/// Given user manager returns users
/// when getting users list
/// return user list message
/// </summary>
Given user manager returns users
when getting users list
return user list message
Given user manager returns users when getting users list return user list message
[Fact]
        public void Users_GivenUserManagerReturnsUsers_ReturnUserListMessage()
        {
            List<User> usersList = new List<User>
            {
                new User
                {
                    UserName = "sla",
                    Email = "sla@gmail.com",
                    CreationDate = DateTime.Now,
                    UpdateDate = DateTime.Now
                }
            };
            _userManagerMock.Setup(mock => mock.Users).Returns(usersList.AsQueryable());
            UsersListMessage resultMessage = _identityService.Users;
            Assert.NotNull(resultMessage);
            Assert.True(resultMessage.OperationStatus);
            Assert.NotEmpty(resultMessage.Users);
            Assert.True(resultMessage.Users.Select(u => u.Login).SequenceEqual(usersList.Select(u => u.UserName)));
            Assert.True(resultMessage.Users.Select(u => u.Email).SequenceEqual(usersList.Select(u => u.Email)));
        }
[ Fact ] public void Users_GivenUserManagerReturnsUsers_ReturnUserListMessage ( ) { List < User > usersList = new List < User > { new User { UserName = " " , Email = " " , CreationDate = DateTime . Now , UpdateDate = DateTime . Now } } ; _userManagerMock . Setup ( mock => mock . Users ) . Returns ( usersList . AsQueryable ( ) ) ; UsersListMessage resultMessage = _identityService . Users ; Assert . NotNull ( resultMessage ) ; Assert . True ( resultMessage . OperationStatus ) ; Assert . NotEmpty ( resultMessage . Users ) ; Assert . True ( resultMessage . Users . Select ( u => u . Login ) . SequenceEqual ( usersList . Select ( u => u . UserName ) ) ) ; Assert . True ( resultMessage . Users . Select ( u => u . Email ) . SequenceEqual ( usersList . Select ( u => u . Email ) ) ) ; }
Given user manager returns users
when getting users list
return user list message
Given user manager returns users when getting users list return user list message
// Arrange // Act // Assert