public void ShouldFilterCollectionBasedOnSecurity() { var mappings = new NullPermissiveExampleSecuredRelationshipBuilder(); var maps = mappings.BuildRelationships(); var map = maps.Single(x => x.Secured == typeof(ExampleLeaf) && x.SecuredBy == typeof(IEnumerable<ExampleRoot>)); var listToFilter = new List<ExampleLeaf> { new ExampleLeaf { SecuredRoots = new List<ExampleRoot> { new ExampleRoot { Id = 1 }, } }, new ExampleLeaf { SecuredRoots = new List<ExampleRoot> { new ExampleRoot { Id = 2 }, } } }; var permissions = new HashSet<long> { 1 }; var results = map.ApplySecurity(listToFilter.AsQueryable(), permissions).ToList(); results.Should().HaveCount(1); }
public void ShouldAddSinglePropertyToGlobalCacheWhenCalled() { var mappings = new NullPermissiveExampleSecuredRelationshipBuilder(); var maps = mappings.BuildRelationships(); maps.Where(x => typeof(ExampleLeaf).IsAssignableFrom(x.Secured) && typeof(ExampleRoot).IsAssignableFrom(x.SecuredBy)).Should().HaveCount(1); }
public void ShouldAddCollectionToGlobalCacheWhenCalled() { var mappings = new NullPermissiveExampleSecuredRelationshipBuilder(); var maps = mappings.BuildRelationships(); maps.Where(x => x.Secured == typeof(ExampleLeaf) && x.SecuredBy == typeof(IEnumerable<ExampleRoot>)).Should().HaveCount(1); }
public void ShouldAddSinglePropertyToGlobalCacheWhenCalled() { var mappings = new NullPermissiveExampleSecuredRelationshipBuilder(); var maps = mappings.BuildRelationships(); maps.Where(x => typeof(ExampleLeaf).IsAssignableFrom(x.Secured) && typeof(ExampleRoot).IsAssignableFrom(x.SecuredBy)).Should().HaveCount(1); }
public void ShouldAddCollectionToGlobalCacheWhenCalled() { var mappings = new NullPermissiveExampleSecuredRelationshipBuilder(); var maps = mappings.BuildRelationships(); maps.Where(x => x.Secured == typeof(ExampleLeaf) && x.SecuredBy == typeof(IEnumerable <ExampleRoot>)).Should().HaveCount(1); }
public void ShouldFilterCollectionBasedOnSecurity() { var mappings = new NullPermissiveExampleSecuredRelationshipBuilder(); var maps = mappings.BuildRelationships(); var map = maps.Single(x => x.Secured == typeof(ExampleLeaf) && x.SecuredBy == typeof(IEnumerable <ExampleRoot>)); var listToFilter = new List <ExampleLeaf> { new ExampleLeaf { SecuredRoots = new List <ExampleRoot> { new ExampleRoot { Id = 1 }, } }, new ExampleLeaf { SecuredRoots = new List <ExampleRoot> { new ExampleRoot { Id = 2 }, } } }; var permissions = new HashSet <long> { 1 }; var results = map.ApplySecurity(listToFilter.AsQueryable(), permissions).ToList(); results.Should().HaveCount(1); }
public void TestFixtureSetUp() { _exampleSecuredRelationshipBuilder = new NullPermissiveExampleSecuredRelationshipBuilder(); _exampleSecuredRelationshipBuilder2 = new NullPermissiveExampleSecuredRelationshipBuilder(); }
public void TestFixtureSetUp() { _exampleSecuredRelationshipBuilder = new NullPermissiveExampleSecuredRelationshipBuilder(); _exampleSecuredRelationshipBuilder2 = new NullPermissiveExampleSecuredRelationshipBuilder(); }