Esempio n. 1
0
        private bool MatchesStates(ISecurityContext context, ICollection <State> states)
        {
            if (context.GetNumberOfStates() > states.Count)
            {
                return(false);
            }

            return(states.All(s => MatchesState(context, s)));
        }
Esempio n. 2
0
        public void CreateSecurityContext()
        {
            OrganizationalStructureTestHelper testHelper = new OrganizationalStructureTestHelper();

            using (testHelper.Transaction.EnterNonDiscardingScope())
            {
                Position position = testHelper.CreatePosition("PositionName");
                position.Delegation = Delegation.Enabled;

                ISecurityContext securityContext = ((ISecurityContextFactory)position).CreateSecurityContext();
                Assert.That(Type.GetType(securityContext.Class), Is.EqualTo(position.GetPublicDomainObjectType()));
                Assert.That(securityContext.Owner, Is.Null);
                Assert.That(securityContext.OwnerGroup, Is.Null);
                Assert.That(securityContext.OwnerTenant, Is.Null);
                Assert.That(securityContext.AbstractRoles, Is.Empty);
                Assert.That(securityContext.GetNumberOfStates(), Is.EqualTo(1));
                Assert.That(securityContext.GetState("Delegation"), Is.EqualTo(EnumWrapper.Get(Delegation.Enabled)));
            }
        }