public void Should_return_group_DisplayNames() { var administratorRoleClaims = new AdministratorRoleClaims(new UserRole { CaseTypes = new List <string> { "Generic", "Financial Remedy" } }); var user = new TestPrincipal(administratorRoleClaims.Claims); var caseTypes = new UserIdentity(user).GetGroupDisplayNames().ToList(); caseTypes.Should().NotBeNull(); caseTypes.Should().HaveCount(caseTypes.Count); caseTypes.Should().Contain("Generic"); caseTypes.Should().Contain("Financial Remedy"); }
public void Should_return_empty_list_of_user_case_types() { var userRole = new UserRole { UserRoleType = UserRoleType.VhOfficer }; var created = new AdministratorRoleClaims(userRole); created.Should().NotBeNull(); created.UserCaseTypes.Should().NotContainNulls(); created.UserCaseTypes.Should().HaveCount(0); var parsed = new AdministratorRoleClaims(created.Claims); parsed.Should().NotBeNull(); parsed.UserCaseTypes.Should().NotBeNull(); parsed.UserCaseTypes.Should().NotContainNulls(); parsed.UserCaseTypes.Should().HaveCount(0); }
public void Should_return_user_case_types() { var userRole = new UserRole { UserRoleType = UserRoleType.VhOfficer, CaseTypes = new List <string> { "Case1", "Case2" } }; var created = new AdministratorRoleClaims(userRole); created.Should().NotBeNull(); created.UserCaseTypes.Should().NotContainNulls(); created.UserCaseTypes.Should().HaveCountGreaterThan(0); created.UserCaseTypes.Should().BeEquivalentTo(userRole.CaseTypes); var parsed = new AdministratorRoleClaims(created.Claims); parsed.Should().NotBeNull(); parsed.UserCaseTypes.Should().NotContainNulls(); parsed.UserCaseTypes.Should().HaveCountGreaterThan(0); parsed.UserCaseTypes.Should().BeEquivalentTo(userRole.CaseTypes); }
public UserIdentity(ClaimsPrincipal currentUser) { _currentUser = currentUser; _administratorRoleClaims = new AdministratorRoleClaims(_currentUser.Claims); }