コード例 #1
0
        private void DoValidation(int expectedErrors)
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(base.Host);

            cmd.Execute(GeneratedApplicationNode);
            Assert.AreEqual(expectedErrors, ValidationErrorsCount);
        }
コード例 #2
0
 public void RequiredNotThereTestWithVistor()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     Assert.IsNotNull(requiredNode.Site);
     cmd.Execute(requiredNode);
     Assert.AreEqual(2, ValidationErrorsCount);
 }
コード例 #3
0
        public void ValidateTest()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(instancesNode);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
コード例 #4
0
        public void MinLengthViolationTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);
            cmd.Execute(minLengthNode);

            Assert.AreEqual(2, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
コード例 #5
0
        public void ValidateTest()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(this.parameterNode);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
コード例 #6
0
 public void RequiredNotThereTestWithVistor()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);
     Assert.IsNotNull(requiredNode.Site);
     cmd.Execute(requiredNode);
     Assert.AreEqual(2, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
 }
コード例 #7
0
        public void ValidateTest()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(databaseTypeCollectionNode);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
コード例 #8
0
        public void ValidateTest()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(connectionStringNode);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
コード例 #9
0
        public void ValidateNoPrefixTest()
        {
            packageNode.Prefix = string.Empty;
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(packageNode);
        }
コード例 #10
0
        public void RequiredNotThereTestWithVistor()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            Assert.IsNotNull(requiredNode.Site);
            cmd.Execute(requiredNode);
            Assert.AreEqual(2, ValidationErrorsCount);
        }
コード例 #11
0
        public void ValidateNoNameTest()
        {
            connectionStringNode.Name = string.Empty;
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(connectionStringNode);
            Assert.AreEqual(1, ValidationErrorsCount);
        }
コード例 #12
0
        public void ValidateNoConnectionStringNodeTest()
        {
            instanceNode.ConnectionStringNode = null;
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(instanceNode);
            Assert.AreEqual(1, ValidationErrorsCount);
        }
コード例 #13
0
        public void MinLengthViolationTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            cmd.Execute(minLengthNode);

            Assert.AreEqual(2, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
コード例 #14
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool Validate()
        {
            ValidateNodeCommand validateCommand = new ValidateNodeCommand(serviceProvider);

            validateCommand.Execute(configurationEditor.MainHierarchy.RootNode);

            return(validateCommand.ValidationSucceeded);
        }
コード例 #15
0
 public void RegexTestWithVistor()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     Assert.IsNotNull(regexNode.Site);
     regexNode.Email = "*****@*****.**";
     cmd.Execute(regexNode);
     Assert.AreEqual(0, ConfigurationErrorsCount);
 }
コード例 #16
0
        public void RequiredNotThereTestWithVistor()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            Assert.IsNotNull(requiredNode.Site);
            cmd.Execute(requiredNode);
            Assert.AreEqual(2, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
コード例 #17
0
 public void RegexViolationTestWithVistor()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     Assert.IsNotNull(regexNode.Site);
     regexNode.Email = "joeblow.com";
     cmd.Execute(regexNode);
     Assert.AreEqual(1, ValidationErrorsCount);
 }
コード例 #18
0
 public void RequiredValueTestWithVistor()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     Assert.IsNotNull(requiredNode.Site);
     requiredNode.Value1 = "aaa";
     requiredNode.Value2 = "aaaaaa";
     cmd.Execute(requiredNode);
     Assert.AreEqual(0, ValidationErrorsCount);
 }
コード例 #19
0
		public void RegexTestWithValidateCommand()
        {
			ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);
            Assert.IsNotNull(regexNode.Site);
            regexNode.Email = "*****@*****.**";
            cmd.Execute(regexNode);

			Assert.AreEqual(0, ValidationAttributeHelper.GetConfigurationErrorsCount(serviceProvider));
        }
コード例 #20
0
        public void MinLengthTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);
            minLengthNode.Value1 = "MyTest";
            minLengthNode.Value2 = "MyTestPassword";
            cmd.Execute(minLengthNode);

            Assert.AreEqual(0, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
コード例 #21
0
        public void ValidateNoNameTest()
        {
            parameterNode.Name = string.Empty;
            Assert.IsTrue(parameterNode.Name.Length == 0);
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(this.parameterNode);
            Assert.AreEqual(1, ValidationErrorsCount);
        }
コード例 #22
0
        public void RegexTestWithVistor()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            Assert.IsNotNull(regexNode.Site);
            regexNode.Email = "*****@*****.**";
            cmd.Execute(regexNode);
            Assert.AreEqual(0, ConfigurationErrorsCount);
        }
コード例 #23
0
        public void RegexViolationTestWithVistor()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            Assert.IsNotNull(regexNode.Site);
            regexNode.Email = "joeblow.com";
            cmd.Execute(regexNode);
            Assert.AreEqual(1, ValidationErrorsCount);
        }
コード例 #24
0
 public void MinLengthViolationTestWithVistor()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     Assert.IsNotNull(minLengthNode.Site);
     IConfigurationErrorLogService configurationErrorLogService = minLengthNode.Site.GetService(typeof(IConfigurationErrorLogService)) as IConfigurationErrorLogService;
     Assert.IsNotNull(configurationErrorLogService);
     cmd.Execute(minLengthNode);
     Assert.AreEqual(2, ValidationErrorsCount);
 }
コード例 #25
0
 public void MaxLengthTestWithCommand()
 {
     maxLengthNode.Value1 = "aaa";
     maxLengthNode.Value2 = "aaaaaa";
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(maxLengthNode);
     Assert.IsNotNull(maxLengthNode.Site);
     Assert.AreEqual(0, ValidationErrorsCount);
 }
コード例 #26
0
        public void RegexViolationTestWithValidateCommand()
        {
			ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);
            Assert.IsNotNull(regexNode.Site);
            regexNode.Email = "joeblow.com";
            cmd.Execute(regexNode);

			Assert.AreEqual(1, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
コード例 #27
0
 public void MaxLengthViolationTestWithCommand()
 {
     maxLengthNode.Value1 = "MyTest";
     maxLengthNode.Value2 = "MyTestPassword";
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(maxLengthNode);
     Assert.IsNotNull(maxLengthNode.Site);
     Assert.AreEqual(2, ValidationErrorsCount);
 }
コード例 #28
0
        public void MaxLengthTestWithCommand()
        {
            maxLengthNode.Value1 = "aaa";
            maxLengthNode.Value2 = "aaaaaa";
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);
            cmd.Execute(maxLengthNode);

            Assert.AreEqual(0, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
コード例 #29
0
        public void RequiredDefaultProviderTest()
        {
            AuthenticationProviderCollectionNode node = new AuthenticationProviderCollectionNode();

            CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration());
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(node);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
コード例 #30
0
        public void MaxLengthViolationTestWithCommand()
        {
            maxLengthNode.Value1 = "MyTest";
            maxLengthNode.Value2 = "MyTestPassword";
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(maxLengthNode);
            Assert.IsNotNull(maxLengthNode.Site);
            Assert.AreEqual(2, ValidationErrorsCount);
        }
        public void MaxLengthTestWithCommand()
        {
            maxLengthNode.Value1 = "aaa";
            maxLengthNode.Value2 = "aaaaaa";
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            cmd.Execute(maxLengthNode);

            Assert.AreEqual(0, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
コード例 #32
0
        public void RequiredValueTestWithVistor()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            Assert.IsNotNull(requiredNode.Site);
            requiredNode.Value1 = "aaa";
            requiredNode.Value2 = "aaaaaa";
            cmd.Execute(requiredNode);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
コード例 #33
0
        public void MaxLengthTestWithCommand()
        {
            maxLengthNode.Value1 = "aaa";
            maxLengthNode.Value2 = "aaaaaa";
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(maxLengthNode);
            Assert.IsNotNull(maxLengthNode.Site);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
コード例 #34
0
        public void MinLengthTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            minLengthNode.Value1 = "MyTest";
            minLengthNode.Value2 = "MyTestPassword";
            cmd.Execute(minLengthNode);

            Assert.AreEqual(0, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
        public void ExpressionPassesValidation()
        {
            expressionTestNode.Expression = "NOT I:?";

            ValidateNodeCommand cmd = new ValidateNodeCommand(ServiceProvider);

            cmd.Execute(expressionTestNode);

            Assert.AreEqual(0, ValidationAttributeHelper.GetValidationErrorsCount(ServiceProvider));
        }
コード例 #36
0
        public void RegexTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            Assert.IsNotNull(regexNode.Site);
            regexNode.Email = "*****@*****.**";
            cmd.Execute(regexNode);

            Assert.AreEqual(0, ValidationAttributeHelper.GetConfigurationErrorsCount(serviceProvider));
        }
コード例 #37
0
        public void TestThatAValidationThatFailsReportsErrorsToUI()
        {
            TestNode node = new TestNode();
            IServiceProvider provider =  ServiceBuilder.Build();
            ValidateNodeCommand cmd = new ValidateNodeCommand(provider, true, false);
            cmd.Execute(node);
            MockUIService uiService = provider.GetService(typeof(IUIService)) as MockUIService;

            Assert.AreEqual(1, uiService.ValidationErrorsCount);
        }
コード例 #38
0
        public void RegexViolationTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            Assert.IsNotNull(regexNode.Site);
            regexNode.Email = "joeblow.com";
            cmd.Execute(regexNode);

            Assert.AreEqual(1, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
コード例 #39
0
        public void CreateFromRuntimeTest()
        {
            DatabaseSettings               databaseSettings     = DatabaseSettingsBuilder.Create(Host);
            DatabaseSettingsNode           databaseSettingsNode = new DatabaseSettingsNode(databaseSettings);
            IUIHierarchy                   hierarchy            = CreateHierarchyAndAddToHierarchyService(databaseSettingsNode, CreateDefaultConfiguration());
            ConnectionStringCollectionNode node = (ConnectionStringCollectionNode)hierarchy.FindNodeByType(typeof(ConnectionStringCollectionNode));
            ValidateNodeCommand            cmd  = new ValidateNodeCommand(Host);

            cmd.Execute(node);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
コード例 #40
0
        public void MinLengthViolationTestWithVistor()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            Assert.IsNotNull(minLengthNode.Site);
            IConfigurationErrorLogService configurationErrorLogService = minLengthNode.Site.GetService(typeof(IConfigurationErrorLogService)) as IConfigurationErrorLogService;

            Assert.IsNotNull(configurationErrorLogService);
            cmd.Execute(minLengthNode);
            Assert.AreEqual(2, ValidationErrorsCount);
        }
コード例 #41
0
        public void TestThatAValidationThatFailsReportsErrorsToUI()
        {
            TestNode            node     = new TestNode();
            IServiceProvider    provider = ServiceBuilder.Build();
            ValidateNodeCommand cmd      = new ValidateNodeCommand(provider, true, false);

            cmd.Execute(node);
            MockUIService uiService = provider.GetService(typeof(IUIService)) as MockUIService;

            Assert.AreEqual(1, uiService.ValidationErrorsCount);
        }
        public void NonExpressionFailsValidation()
        {
            string nonExpression = "hello, this doesnt make sense";

            expressionTestNode.Expression = nonExpression;

            ValidateNodeCommand cmd = new ValidateNodeCommand(ServiceProvider);

            cmd.Execute(expressionTestNode);

            Assert.AreEqual(1, ValidationAttributeHelper.GetValidationErrorsCount(ServiceProvider));
        }
コード例 #43
0
        public void CreateFromRuntimeTest()
        {
            DatabaseSettings           databaseSettings = DatabaseSettingsBuilder.Create(Host);
            DatabaseTypeCollectionNode node             = new DatabaseTypeCollectionNode(databaseSettings.DatabaseTypes);

            CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration());
            Assert.AreEqual(databaseSettings.DatabaseTypes.Count, node.Nodes.Count);
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(node);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
コード例 #44
0
        public void MatchWithEmptyValueCausesValidationError()
        {
            MemberNameMatchingRuleNode ruleNode = new MemberNameMatchingRuleNode();

            ruleNode.Name = "RuleName";
            ruleNode.Matches.Add(new Match("", false));

            ValidateNodeCommand cmd = new ValidateNodeCommand(ServiceProvider, true, false);

            cmd.Execute(ruleNode);
            Assert.IsFalse(cmd.ValidationSucceeded);
        }
コード例 #45
0
 private void DoValidation(int expectedErrors)
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(base.Host);
     cmd.Execute(GeneratedApplicationNode);
     Assert.AreEqual(expectedErrors, ValidationErrorsCount);
 }