public void CreateAclExpansionEntryTest() { var userRoleAclAce = new UserRoleAclAceCombination(Role, Ace); var allowedAccessTypes = new[] { WriteAccessType, DeleteAccessType }; var deniedAccessTypes = new[] { ReadAccessType }; AccessInformation accessInformation = new AccessInformation(allowedAccessTypes, deniedAccessTypes); var mocks = new MockRepository(); var aclExpansionEntryCreatorMock = mocks.PartialMock <AclExpansionEntryCreator> (); var aclProbe = AclProbe.CreateAclProbe(User, Role, Ace); var accessTypeStatisticsMock = mocks.StrictMock <AccessTypeStatistics>(); accessTypeStatisticsMock.Expect(x => x.IsInAccessTypesContributingAces(userRoleAclAce.Ace)).Return(true); aclExpansionEntryCreatorMock.Expect(x => x.GetAccessTypes(userRoleAclAce)). Return(new AclExpansionEntryCreator_GetAccessTypesResult(accessInformation, aclProbe, accessTypeStatisticsMock)); aclExpansionEntryCreatorMock.Replay(); accessTypeStatisticsMock.Replay(); var aclExpansionEntry = aclExpansionEntryCreatorMock.CreateAclExpansionEntry(userRoleAclAce); aclExpansionEntryCreatorMock.VerifyAllExpectations(); accessTypeStatisticsMock.VerifyAllExpectations(); Assert.That(aclExpansionEntry.User, Is.EqualTo(userRoleAclAce.User)); Assert.That(aclExpansionEntry.Role, Is.EqualTo(userRoleAclAce.Role)); Assert.That(aclExpansionEntry.AccessControlList, Is.EqualTo(userRoleAclAce.Acl)); Assert.That(aclExpansionEntry.AccessConditions, Is.EqualTo(aclProbe.AccessConditions)); Assert.That(aclExpansionEntry.AllowedAccessTypes, Is.EqualTo(allowedAccessTypes)); Assert.That(aclExpansionEntry.DeniedAccessTypes, Is.EqualTo(deniedAccessTypes)); }
public void CompoundValueEqualityComparerTest() { var userRoleAclAceCombination = new UserRoleAclAceCombination(Role, Ace); Assert.That(UserRoleAclAceCombination.Comparer.GetEqualityParticipatingObjects(userRoleAclAceCombination), Is.EqualTo(new object[] { Role, Ace })); }
public void EqualityTest() { var userRoleAclAceCombination = new UserRoleAclAceCombination(Role, Ace); var userRoleAclAceCombinationSame = new UserRoleAclAceCombination(Role, Ace); Assert.That(userRoleAclAceCombination, Is.EqualTo((Object)userRoleAclAceCombination)); Assert.That(userRoleAclAceCombination, Is.EqualTo((Object)userRoleAclAceCombinationSame)); Assert.That(userRoleAclAceCombinationSame, Is.EqualTo((Object)userRoleAclAceCombination)); }
public void EqualsUserRoleAclAceCombinationTest() { var userRoleAclAceCombination = new UserRoleAclAceCombination(Role, Ace); var userRoleAclAceCombinationSame = new UserRoleAclAceCombination(Role, Ace); Assert.That(userRoleAclAceCombination.Equals(userRoleAclAceCombination), Is.True); Assert.That(userRoleAclAceCombination.Equals(userRoleAclAceCombinationSame), Is.True); Assert.That(userRoleAclAceCombinationSame.Equals(userRoleAclAceCombination), Is.True); }
public void InEqualityTest() { var userRoleAclAceCombination = new UserRoleAclAceCombination(Role2, Ace3); var userRoleAclAceCombinationDifferent0 = new UserRoleAclAceCombination(Role2, Ace); var userRoleAclAceCombinationDifferent1 = new UserRoleAclAceCombination(Role, Ace3); Assert.That(userRoleAclAceCombination, Is.Not.EqualTo(userRoleAclAceCombinationDifferent0)); Assert.That(userRoleAclAceCombination, Is.Not.EqualTo(userRoleAclAceCombinationDifferent1)); Assert.That(userRoleAclAceCombinationDifferent0, Is.Not.EqualTo(userRoleAclAceCombination)); Assert.That(userRoleAclAceCombinationDifferent1, Is.Not.EqualTo(userRoleAclAceCombination)); }
public void GetAccessTypesDoesNotModifyUserRoles() { var aclExpansionEntryCreator = new AclExpansionEntryCreator(); //AclProbe aclProbe; //AccessTypeStatistics accessTypeStatistics; User.Roles.Add(Role2); var userRoleAclAceCombination = new UserRoleAclAceCombination(Role, Ace); var accessTypesResult = aclExpansionEntryCreator.GetAccessTypes(userRoleAclAceCombination); //, out aclProbe, out accessTypeStatistics); Assert.That(User.Roles, Is.EquivalentTo(new[] { Role, Role2 })); Assert.That(accessTypesResult.AclProbe.SecurityToken.Principal.Roles, Is.EquivalentTo(new[] { Role }).Using(PrincipalRoleComparer.Instance)); }