public void Test_GetQueries_SubjectWith2SEs2SQs() { RuleRepository ruleRepository; EntityType securableEntityType1; EntityType securableEntityType2; Role subject; AccessRule accessRule1; AccessRule accessRule2; List <AccessRule> result; IEntityRepository entityRepository = Factory.EntityRepository; // Test: // // |--------------> Read // | // Subject -------> Access Rule -----------> SE1 // | // |-----> Access Rule -----------> SE2 // | // |--------------> Read using (DatabaseContext.GetContext(true)) { securableEntityType1 = Entity.Create <EntityType>(); securableEntityType1.Save(); accessRule1 = Entity.Create <AccessRule>(); accessRule1.AccessRuleEnabled = true; accessRule1.PermissionAccess.Add(Permissions.Read.Entity.As <Permission>()); accessRule1.ControlAccess = securableEntityType1.As <SecurableEntity>(); accessRule1.Save(); securableEntityType2 = Entity.Create <EntityType>(); securableEntityType2.Save(); accessRule2 = Entity.Create <AccessRule>(); accessRule2.AccessRuleEnabled = true; accessRule2.PermissionAccess.Add(Permissions.Read.Entity.As <Permission>()); accessRule2.ControlAccess = securableEntityType2.As <SecurableEntity>(); accessRule2.Save(); subject = Entity.Create <Role>(); subject.AllowAccess.Add(accessRule1.As <AccessRule>()); subject.AllowAccess.Add(accessRule2.As <AccessRule>()); subject.Save(); ruleRepository = new RuleRepository(entityRepository); result = new List <AccessRule>(ruleRepository.GetAccessRules(subject.Id, Permissions.Read, new[] { securableEntityType1.Id, securableEntityType2.Id })); Assert.That(result, Is.Not.Null); Assert.That(result, Has.Count.EqualTo(2)); } }