示例#1
0
        public void ValidateRaisesAnErrorIfNullChildConditionsDefined()
        {
            var processor = this.mocks.Create <IConfigurationErrorProcesser>(MockBehavior.Strict).Object;

            Mock.Get(processor).Setup(_processor => _processor.ProcessError(
                                          "Validation failed for orCondition - at least one child condition must be supplied")).Verifiable();

            var condition = new OrTaskCondition();

            condition.Validate(null, null, processor);

            this.mocks.VerifyAll();
        }
        public void ValidateRaisesAnErrorIfNullChildConditionsDefined()
        {
            var processor = this.mocks.StrictMock <IConfigurationErrorProcesser>();

            Expect.Call(() => processor.ProcessError(
                            "Validation failed for orCondition - at least one child condition must be supplied"));

            this.mocks.ReplayAll();
            var condition = new OrTaskCondition();

            condition.Validate(null, null, processor);

            this.mocks.VerifyAll();
        }
示例#3
0
        public void ValidateCallsChildrenValidation()
        {
            var processor      = this.mocks.Create <IConfigurationErrorProcesser>(MockBehavior.Strict).Object;
            var validateCalled = false;
            var childCondition = new MockCondition
            {
                ValidateAction = (c, t, ep) => validateCalled = true
            };

            var condition = new OrTaskCondition
            {
                Conditions = new[] { childCondition }
            };

            condition.Validate(null, ConfigurationTrace.Start(this), processor);

            this.mocks.VerifyAll();
            Assert.IsTrue(validateCalled);
        }