Example #1
0
        public void ProjectSetProjectRuleConfigurationOverrideShouldReplaceExisting()
        {
            _project = new CalidusProject(@"C:\src\test.project", _provider);

            IRule rule = Mocker.DynamicMock <IRule>();
            IRuleConfigurationOverride one = Mocker.DynamicMock <IRuleConfigurationOverride>();

            Expect.Call(one.Rule).Return(rule.GetType()).Repeat.Twice();

            Mocker.ReplayAll();

            _project.SetProjectRuleConfigurationOverrideTo(one);
            Assert.AreEqual(1, _project.GetProjectRuleConfigurationOverrides().Count());
            _project.SetProjectRuleConfigurationOverrideTo(one);
            Assert.AreEqual(1, _project.GetProjectRuleConfigurationOverrides().Count());

            Mocker.VerifyAll();
        }
Example #2
0
        public void ProjectSetProjectRuleConfigurationOverrideShouldAddOverrides()
        {
            _project = new CalidusProject(@"C:\src\test.project", _provider);
            //need to make sure to have different rule types
            StatementRuleBase ruleOne = Mocker.DynamicMock <StatementRuleBase>("test");
            BlockRuleBase     ruleTwo = Mocker.DynamicMock <BlockRuleBase>("test");

            IRuleConfigurationOverride one = Mocker.DynamicMock <IRuleConfigurationOverride>();
            IRuleConfigurationOverride two = Mocker.DynamicMock <IRuleConfigurationOverride>();

            Expect.Call(one.Rule).Return(ruleOne.GetType()).Repeat.Once();
            Expect.Call(two.Rule).Return(ruleTwo.GetType()).Repeat.Once();

            Mocker.ReplayAll();

            Assert.AreEqual(0, _project.GetProjectRuleConfigurationOverrides().Count());
            _project.SetProjectRuleConfigurationOverrideTo(one);
            Assert.AreEqual(1, _project.GetProjectRuleConfigurationOverrides().Count());
            _project.SetProjectRuleConfigurationOverrideTo(two);
            Assert.AreEqual(2, _project.GetProjectRuleConfigurationOverrides().Count());

            Mocker.VerifyAll();
        }