Example #1
0
        public void AddSuccessResultDoesNotFail()
        {
            var root = new TwoPropertyRules();
            var rule = new TwoProps(TwoPropertyRules.Value1Property, TwoPropertyRules.Value2Property);

            var applicationContext = _testDIContext.CreateTestApplicationContext();
            var ctx = new Csla.Rules.RuleContext(applicationContext, null, rule, root,
                                                 new Dictionary <Core.IPropertyInfo, object>
            {
                { TwoPropertyRules.Value1Property, "a" },
                { TwoPropertyRules.Value2Property, "b" }
            });

            ctx.AddSuccessResult(false);
            Assert.IsTrue(true, "Must not fail.");
        }
Example #2
0
        public void AddInformationResultOnPropertyThrowsErrorWhenMessageIsEmpty()
        {
            var root = new TwoPropertyRules();
            var rule = new TwoProps(TwoPropertyRules.Value1Property, TwoPropertyRules.Value2Property);

            var applicationContext = _testDIContext.CreateTestApplicationContext();
            var ctx = new Csla.Rules.RuleContext(applicationContext, null, rule, root,
                                                 new Dictionary <Core.IPropertyInfo, object>
            {
                { TwoPropertyRules.Value1Property, "a" },
                { TwoPropertyRules.Value2Property, "b" }
            });

            ctx.AddInformationResult(TwoPropertyRules.Value1Property, string.Empty);
            Assert.Fail("Must throw exception.");
        }