Tests/Identity.Infrastructure.Tests/Services/IdentityServiceTests.cs
/// <summary>
/// Given role manager returns roles
/// when getting roles list
/// return roles list message
/// </summary>
Given role manager returns roles
when getting roles list
return roles list message
Given role manager returns roles when getting roles list return roles list message
[Fact]
        public void Roles_GivenRoleManagerReturnsRoles_ReturnRolesListMessage()
        {
            List<Role> rolesList = new List<Role>
            {
                new Role
                {
                    Name = "yeet",
                    CreationDate = DateTime.Now,
                    UpdateDate = DateTime.Now
                }
            };
            _roleManagerMock.Setup(mock => mock.Roles).Returns(rolesList.AsQueryable());
            RolesListMessage resultMessage = _identityService.Roles;
            Assert.NotNull(resultMessage);
            Assert.True(resultMessage.OperationStatus);
            Assert.NotEmpty(resultMessage.Roles);
            Assert.True(resultMessage.Roles.Select(u => u.Name).SequenceEqual(rolesList.Select(u => u.Name)));
        }
[ Fact ] public void Roles_GivenRoleManagerReturnsRoles_ReturnRolesListMessage ( ) { List < Role > rolesList = new List < Role > { new Role { Name = " " , CreationDate = DateTime . Now , UpdateDate = DateTime . Now } } ; _roleManagerMock . Setup ( mock => mock . Roles ) . Returns ( rolesList . AsQueryable ( ) ) ; RolesListMessage resultMessage = _identityService . Roles ; Assert . NotNull ( resultMessage ) ; Assert . True ( resultMessage . OperationStatus ) ; Assert . NotEmpty ( resultMessage . Roles ) ; Assert . True ( resultMessage . Roles . Select ( u => u . Name ) . SequenceEqual ( rolesList . Select ( u => u . Name ) ) ) ; }
Given role manager returns roles
when getting roles list
return roles list message
Given role manager returns roles when getting roles list return roles list message
// Arrange // Act // Assert