예제 #1
0
        public void SimpleRuleSolver_solves_AttributeRule()
        {
            var mventry = new MockMventry();

            mventry["uid"].Value       = "espenaske";
            mventry["givenName"].Value = "per";


            var attributeRule = new AttributeRule()
            {
                IsPresent     = true,
                Attribute     = "uid",
                RequiredValue = "espenaske"
            };

            var attributeRule2 = new AttributeRule()
            {
                Attribute     = "givenName",
                RequiredValue = "per"
            };


            var provRule = new ProvisionRule();

            provRule.AttributeRules = new[] { attributeRule, attributeRule2 };

            var  ruleSolver = new SimpleRuleSolver(provRule);
            bool solved     = ruleSolver.PassesRule(mventry);

            Assert.IsTrue(solved);
        }
예제 #2
0
        public void SimpleRuleSolver_solves_ObjectRequirement()
        {
            var correctRule = new ProvisionRule();
            var wrongRule   = new ProvisionRule();
            var mventry     = new MockMventry("TestObj");

            wrongRule.RequiredObjects   = new[] { "WrongObj" };
            correctRule.RequiredObjects = new[] { "TestObj" };

            var ruleSolver = new SimpleRuleSolver(wrongRule);

            Assert.IsFalse(ruleSolver.PassesRule(mventry));
            ruleSolver = new SimpleRuleSolver(correctRule);
            Assert.IsTrue(ruleSolver.PassesRule(mventry));
        }
예제 #3
0
        public void SimpleRuleSolver_solves_AgentRequirement()
        {
            var mventry = new MockMventry();

            mventry.ConnectedMAs["HR MA"].Connectors.StartNewConnector("person");

            var provRule = new ProvisionRule();

            //provRule.AttributeRules = new[] { attributeRule };
            provRule.RequiredAgents = new [] { "HR MA" };

            var  ruleSolver = new SimpleRuleSolver(provRule);
            bool solved     = ruleSolver.PassesRule(mventry);

            Assert.IsTrue(solved);
        }