Tests/Identity.Api.Tests/Controllers/RolesControllerTests.cs
/// <summary>
/// Given identity service retrieves roles successfully
/// When getting all roles
/// return role list
/// </summary>
Given identity service retrieves roles successfully
When getting all roles
return role list
Given identity service retrieves roles successfully When getting all roles return role list
[Fact]
        public void GetAllRoles_WhenIdentityServiceSucceeds_ReturnRolesListMessage()
        {
            RolesListMessage rolesListMessage = new RolesListMessage
            {
                OperationStatus = true,
                Roles = new List<RoleResult>
                {
                    new RoleResult
                    {
                        Name = "nihaw",
                        CreationDate = DateTime.Now,
                        UpdateDate = DateTime.Now
                    }
                }
            };
            _identityServiceMock.Setup(mock => mock.Roles).Returns(rolesListMessage);
            OkObjectResult result = _rolesController.GetAllRoles() as OkObjectResult;
            Assert.NotNull(result);
            Assert.Equal(rolesListMessage, result.Value);
        }
[ Fact ] public void GetAllRoles_WhenIdentityServiceSucceeds_ReturnRolesListMessage ( ) { RolesListMessage rolesListMessage = new RolesListMessage { OperationStatus = true , Roles = new List < RoleResult > { new RoleResult { Name = " " , CreationDate = DateTime . Now , UpdateDate = DateTime . Now } } } ; _identityServiceMock . Setup ( mock => mock . Roles ) . Returns ( rolesListMessage ) ; OkObjectResult result = _rolesController . GetAllRoles ( ) as OkObjectResult ; Assert . NotNull ( result ) ; Assert . Equal ( rolesListMessage , result . Value ) ; }
Given identity service retrieves roles successfully
When getting all roles
return role list
Given identity service retrieves roles successfully When getting all roles return role list
// Arrange // Act // Assert