public void ValidateNoNameTest()
 {
     connectionStringNode.Name = string.Empty;
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(connectionStringNode);
     Assert.AreEqual(1, ValidationErrorsCount);
 }
示例#2
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);
 }
 public void NotRequiredDefaultProviderTest()
 {
     AuthorizationProviderCollectionNode node = new AuthorizationProviderCollectionNode();
     CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration());
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(node);
     Assert.AreEqual(0, ValidationErrorsCount);
 }
        public void ExpressionPassesValidation()
        {
            expressionTestNode.Expression = "NOT I:?";

            ValidateNodeCommand cmd = new ValidateNodeCommand(ServiceProvider);
            cmd.Execute(expressionTestNode);

            Assert.AreEqual(0, ValidationAttributeHelper.GetValidationErrorsCount(ServiceProvider));
        }
        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);
     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 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);
 }
 public void CreateFromRuntimeTest()
 {
     DatabaseSettings databaseSettings = DatabaseSettingsBuilder.Create(Host);
     OraclePackageData data = ((OracleConnectionStringData)databaseSettings.ConnectionStrings["OracleConnection"]).OraclePackages["ENTLIB"];
     OraclePackageNode node = new OraclePackageNode(data);
     CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration());
     Assert.AreEqual(data.Name, node.Name);
     Assert.AreEqual(data.Prefix, node.Prefix);
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(node);
 }
 public void CreateFromRuntimeTest()
 {
     DatabaseSettings databaseSettings = DatabaseSettingsBuilder.Create(Host);
     OracleConnectionStringData data = databaseSettings.ConnectionStrings["OracleConnection"] as OracleConnectionStringData;
     OracleConnectionStringNode node = new OracleConnectionStringNode(data);
     CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration());
     Assert.AreEqual(data.Name, node.Name);
     Assert.AreEqual(4, node.Nodes.Count);
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(node);
     Assert.AreEqual(0, ValidationErrorsCount);
 }
示例#10
0
 public void CreateFromRuntimeTest()
 {
     DatabaseSettings databaseSettings = DatabaseSettingsBuilder.Create(Host);
     ParameterData data = databaseSettings.ConnectionStrings["Northwind"].Parameters["server"];
     ParameterNode node = new ParameterNode(data);
     CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration());
     Assert.AreEqual(data.Name, node.Name);
     Assert.AreEqual(data.Value, node.Value);
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(node);
     Assert.AreEqual(0, ValidationErrorsCount);
 }
 private bool DoValidationCommand()
 {
     using (ValidateNodeCommand cmd = new ValidateNodeCommand(ServiceProvider, false, false))
     {
         cmd.Execute(ServiceHelper.GetCurrentRootNode(ServiceProvider));
         if (!cmd.ValidationSucceeded)
         {
             UIService.ShowMessage(Resources.ValidationErrorsMessage, Resources.SaveApplicationCaption, MessageBoxButtons.OK);
             saveSucceeded = false;
             return(false);
         }
         return(true);
     }
 }
 private bool DoValidationCommand(ConfigurationNode node)
 {
     using (ValidateNodeCommand cmd = new ValidateNodeCommand(ServiceProvider, false, false))
     {
         cmd.Execute(node.Hierarchy.RootNode);
         if (!cmd.ValidationSucceeded)
         {
             UIService.ShowMessage(SR.ValidationErrorsMessage, SR.SaveApplicationCaption, MessageBoxButtons.OK);
             saveSucceeded = false;
             return(false);
         }
         return(true);
     }
 }
 private bool DoValidationCommand()
 {
     using(ValidateNodeCommand cmd = new ValidateNodeCommand(ServiceProvider, false, false))
     {
         cmd.Execute(ServiceHelper.GetCurrentRootNode(ServiceProvider));
         if (!cmd.ValidationSucceeded)
         {
             UIService.ShowMessage(Resources.ValidationErrorsMessage, Resources.SaveApplicationCaption, MessageBoxButtons.OK);
             saveSucceeded = false;
             return false;
         }
         return true;
     }
 }
        public void SaveDefaultAuthenticationProviderAndSaveAndReloadsCorrectly()
        {
            GeneratedHierarchy.Load();

            AddConfigurationSectionCommand cmd = new AddConfigurationSectionCommand(Host, typeof(SecuritySettingsNode), SecuritySettings.SectionName);
            cmd.Execute(GeneratedApplicationNode);

            SecuritySettingsNode securitySettingsNode = GeneratedHierarchy.FindNodeByType(typeof(SecuritySettingsNode)) as SecuritySettingsNode;
            Assert.IsNotNull(securitySettingsNode);
            AuthenticationProviderCollectionNode authenticationProviderCollectionNode = GeneratedHierarchy.FindNodeByType(securitySettingsNode, typeof(AuthenticationProviderCollectionNode)) as AuthenticationProviderCollectionNode;
            Assert.IsNotNull(authenticationProviderCollectionNode);

            AddChildNodeCommand addChildNodeCommand = new AddChildNodeCommand(Host, typeof(DbAuthenticationProviderNode));
            addChildNodeCommand.Execute(authenticationProviderCollectionNode);
            Assert.AreEqual(typeof(DbAuthenticationProviderNode), addChildNodeCommand.ChildNode.GetType());
            DbAuthenticationProviderNode dbAuthenticationProviderNode = (DbAuthenticationProviderNode)addChildNodeCommand.ChildNode;
            securitySettingsNode.DefaultAuthenticationInstance = (AuthenticationProviderNode)addChildNodeCommand.ChildNode;

            addChildNodeCommand = new AddChildNodeCommand(Host, typeof(HashAlgorithmProviderNode));
            CryptographySettingsNode cryptographySettingsNode = GeneratedHierarchy.FindNodeByType(typeof(CryptographySettingsNode)) as CryptographySettingsNode;
            Assert.IsNotNull(cryptographySettingsNode);
            HashProviderCollectionNode hashProviderCollectionNode = GeneratedHierarchy.FindNodeByType(typeof(HashProviderCollectionNode)) as HashProviderCollectionNode;
            Assert.IsNotNull(hashProviderCollectionNode);
            addChildNodeCommand.Execute(hashProviderCollectionNode);
            Assert.AreEqual(typeof(HashAlgorithmProviderNode), addChildNodeCommand.ChildNode.GetType());

            dbAuthenticationProviderNode.HashProvider = (HashProviderNode)addChildNodeCommand.ChildNode;

            DatabaseSettingsNode databaseSettingsNode = GeneratedHierarchy.FindNodeByType(typeof(DatabaseSettingsNode)) as DatabaseSettingsNode;
            Assert.IsNotNull(databaseSettingsNode);
            InstanceCollectionNode instanceCollectionNode = GeneratedHierarchy.FindNodeByType(databaseSettingsNode,  typeof(InstanceCollectionNode)) as InstanceCollectionNode;
            Assert.IsNotNull(instanceCollectionNode);
            Assert.IsTrue(instanceCollectionNode.Nodes.Count > 0);
            InstanceNode instanceNode = (InstanceNode)instanceCollectionNode.Nodes[0];

            dbAuthenticationProviderNode.Database = instanceNode;

            ValidateNodeCommand validateNodeCommand = new ValidateNodeCommand(Host);
            validateNodeCommand.Execute(GeneratedApplicationNode);
            Assert.AreEqual(0, ConfigurationErrorsCount);

            SaveApplicationConfigurationNodeCommand saveCmd = new SaveApplicationConfigurationNodeCommand(Host);
            saveCmd.Execute(GeneratedApplicationNode);

            ApplicationConfigurationNode applicationConfigurationNode = new ApplicationConfigurationNode(ApplicationData.FromCurrentAppDomain());
            IUIHierarchy hierarchy = CreateHierarchyAndAddToHierarchyService(applicationConfigurationNode, CreateDefaultConfiguration());
            HierarchyService.SelectedHierarchy = hierarchy;
            hierarchy.Open();
        }
示例#15
0
 public void CreateFromRuntimeTest()
 {
     DatabaseSettings databaseSettings = DatabaseSettingsBuilder.Create(Host);
     DatabaseSettingsNode databaseSettingsNode = new DatabaseSettingsNode(databaseSettings);
     IUIHierarchy hierarchy = CreateHierarchyAndAddToHierarchyService(databaseSettingsNode, CreateDefaultConfiguration());
     databaseSettingsNode.ResolveNodeReferences();
     InstanceData data = databaseSettings.Instances[name];
     InstanceCollectionNode collectionNode = hierarchy.FindNodeByType(typeof(InstanceCollectionNode)) as InstanceCollectionNode;
     InstanceNode node = hierarchy.FindNodeByName(collectionNode, name) as InstanceNode;
     Assert.AreEqual(data.Name, node.Name);
     Assert.AreEqual(data.DatabaseTypeName, node.DatabaseTypeName);
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(node);
     Assert.AreEqual(0, ValidationErrorsCount);
 }
 public void ValidateTest()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(instancesNode);
     Assert.AreEqual(0, ValidationErrorsCount);
 }
 public void ValidateTest()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(connectionStringNode);
     Assert.AreEqual(0, ValidationErrorsCount);
 }
示例#18
0
 public void ValidateNoConnectionStringNodeTest()
 {
     instanceNode.ConnectionStringNode = null;
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(instanceNode);
     Assert.AreEqual(1, ValidationErrorsCount);
 }
示例#19
0
 public void ValidateNoPrefixTest()
 {
     packageNode.Prefix = string.Empty;
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(packageNode);
 }
 public void ValidateTest()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(databaseTypeCollectionNode);
     Assert.AreEqual(0, ValidationErrorsCount);
 }
示例#21
0
 public void ValidateTest()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(this.parameterNode);
     Assert.AreEqual(0, ValidationErrorsCount);
 }
 private bool DoValidationCommand(ConfigurationNode node)
 {
     using(ValidateNodeCommand cmd = new ValidateNodeCommand(ServiceProvider, false, false))
     {
         cmd.Execute(node.Hierarchy.RootNode);
         if (!cmd.ValidationSucceeded)
         {
             UIService.ShowMessage(SR.ValidationErrorsMessage, SR.SaveApplicationCaption, MessageBoxButtons.OK);
             saveSucceeded = false;
             return false;
         }
         return true;
     }
 }
示例#23
0
 public void ValidateTest()
 {
     ValidateNodeCommand cmd = new ValidateNodeCommand(Host);
     cmd.Execute(packageNode);
 }