private void DoValidation(int expectedErrors)
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(base.Host);

            cmd.Execute(GeneratedApplicationNode);
            Assert.AreEqual(expectedErrors, ValidationErrorsCount);
        }
 public void RequiredNotThereTestWithVistor()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     Assert.IsNotNull(requiredNode.Site);
     cmd.Execute(requiredNode);
     Assert.AreEqual(2, ValidationErrorsCount);
 }
        public void ValidateTest()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(instancesNode);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
        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);
        }
 public void RequiredNotThereTestWithVistor()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);
     Assert.IsNotNull(requiredNode.Site);
     cmd.Execute(requiredNode);
     Assert.AreEqual(2, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
 }
        public void ValidateTest()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(databaseTypeCollectionNode);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
        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);
        }
        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);
        }
        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);
 }
		public void RegexTestWithValidateCommand()
        {
			ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);
            Assert.IsNotNull(regexNode.Site);
            regexNode.Email = "*****@*****.**";
            cmd.Execute(regexNode);

			Assert.AreEqual(0, ValidationAttributeHelper.GetConfigurationErrorsCount(serviceProvider));
        }
        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);
        }
 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);
 }
 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);
 }
        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));
        }
 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));
        }
示例#29
0
        public void RequiredDefaultProviderTest()
        {
            AuthenticationProviderCollectionNode node = new AuthenticationProviderCollectionNode();

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

            cmd.Execute(node);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
        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);
        }
        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);
        }
        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));
        }
        public void RegexTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

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

            Assert.AreEqual(0, ValidationAttributeHelper.GetConfigurationErrorsCount(serviceProvider));
        }
        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 RegexViolationTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

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

            Assert.AreEqual(1, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
        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);
        }
        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);
        }
        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));
        }
        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);
        }
 private void DoValidation(int expectedErrors)
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(base.Host);
     cmd.Execute(GeneratedApplicationNode);
     Assert.AreEqual(expectedErrors, ValidationErrorsCount);
 }