Beispiel #1
0
        public void CanCreateElementFromNode()
        {
            ManageableConfigurationSourceElement     originalElement = new ManageableConfigurationSourceElement("name", "test.config", "app", true, false);
            ManageableConfigurationSourceElementNode node            = new ManageableConfigurationSourceElementNode(originalElement);

            String[] assemblyNames = new String[] { Assembly.GetExecutingAssembly().GetName().Name + ".dll" };
            ManageableConfigurationSourceElementBuilder builder = new ManageableConfigurationSourceElementBuilder(node, new ConfigurationManageabilityProviderAttributeRetriever(assemblyNames));

            ManageableConfigurationSourceElement createdElement = builder.Build();

            Assert.AreEqual(originalElement.Name, createdElement.Name);
            Assert.AreEqual(originalElement.FilePath, createdElement.FilePath);
            Assert.AreEqual(originalElement.ApplicationName, createdElement.ApplicationName);
            Assert.AreEqual(originalElement.EnableGroupPolicies, createdElement.EnableGroupPolicies);
            Assert.AreEqual(originalElement.EnableWmi, createdElement.EnableWmi);
        }
Beispiel #2
0
        public void CanCreateElementFromNewNode()
        {
            ManageableConfigurationSourceElementNode node = new ManageableConfigurationSourceElementNode();

            node.Name                = "name";
            node.File                = "test.config";
            node.ApplicationName     = "app";
            node.EnableGroupPolicies = true;
            node.EnableWmi           = false;

            String[] assemblyNames = new String[] { typeof(MockConfigurationSectionManageabilityProvider).Assembly.GetName().Name + ".dll" };
            ManageableConfigurationSourceElementBuilder builder
                = new ManageableConfigurationSourceElementBuilder(node, new ConfigurationManageabilityProviderAttributeRetriever(assemblyNames));

            ManageableConfigurationSourceElement createdElement = builder.Build();

            Assert.AreEqual(node.Name, createdElement.Name);
            Assert.AreEqual(node.File, createdElement.FilePath);
            Assert.AreEqual(node.ApplicationName, createdElement.ApplicationName);
            Assert.AreEqual(node.EnableGroupPolicies, createdElement.EnableGroupPolicies);
            Assert.AreEqual(node.EnableWmi, createdElement.EnableWmi);
            Assert.AreEqual(1, createdElement.ConfigurationManageabilityProviders.Count);
        }