public void GetNetworkFromNetworkCollectionDoesntGetNull()
        {
            EndpointSection section = (EndpointSection)ConfigurationManager.GetSection("Endpoints");
            NetworkElement  element = section.EndpointItemCollection.GetEndpoint("MyHost").Networks.GetNetwork("Internet");

            Assert.IsNotNull(element);
        }
        public void EndpointsCredentialsInEndpointCollectionAreTheSameThanAppConfig()
        {
            EndpointSection section = (EndpointSection)ConfigurationManager.GetSection("Endpoints");

            Assert.AreEqual("defaultUser", section.EndpointItemCollection.GetEndpoint("MyHost").UserName);
            Assert.AreEqual("4444", section.EndpointItemCollection.GetEndpoint("MyHost").Password);
            Assert.IsNull(section.EndpointItemCollection.GetEndpoint("MyHost").Domain);
        }
        public void SectionGetEndpointItemsCollectionContainsSameQuantityThanAppConfig()
        {
            EndpointSection section = (EndpointSection)ConfigurationManager.GetSection("Endpoints");

            EndpointItemElementCollection collection = section.EndpointItemCollection;

            Assert.AreEqual(2, collection.Count);
        }
        public void GetEndpointFromEndpointItemsCollectionDoesntGetNull()
        {
            EndpointSection     section  = (EndpointSection)ConfigurationManager.GetSection("Endpoints");
            EndpointItemElement element  = section.EndpointItemCollection.GetEndpoint("MyHost");
            EndpointItemElement element2 = section.EndpointItemCollection.GetEndpoint("NoDefault");

            Assert.IsNotNull(element);
            Assert.IsNotNull(element2);
        }
        public void NetworkAddressInNetworkCollectionAreTheSameThanAppConfig()
        {
            EndpointSection section = (EndpointSection)ConfigurationManager.GetSection("Endpoints");

            Assert.AreEqual("http://internet/MyHost",
                            section.EndpointItemCollection.GetEndpoint("MyHost").Networks.GetNetwork("Internet").Address);
            Assert.AreEqual("http://work/MyHost",
                            section.EndpointItemCollection.GetEndpoint("MyHost").Networks.GetNetwork("Work").Address);
        }
        public void NetworkCredentialsInNetworkCollectionAreTheSameThanAppConfig()
        {
            EndpointSection section = (EndpointSection)ConfigurationManager.GetSection("Endpoints");

            Assert.AreEqual("peter",
                            section.EndpointItemCollection.GetEndpoint("MyHost").Networks.GetNetwork("Internet").UserName);
            Assert.AreEqual("1234", section.EndpointItemCollection.GetEndpoint("MyHost").Networks.GetNetwork("Internet").Password);
            Assert.AreEqual("myDomain",
                            section.EndpointItemCollection.GetEndpoint("MyHost").Networks.GetNetwork("Internet").Domain);
        }
예제 #7
0
        private void LoadEndpoints()
        {
            EndpointSection endpointSection = ConfigurationManager.GetSection(EndpointsConfigurationSectionName) as EndpointSection;

            foreach (EndpointItemElement endpointItemElement in endpointSection.EndpointItemCollection)
            {
                ListViewItem item = new ListViewItem(endpointItemElement.Name, "endpoint");
                item.ToolTipText = Properties.Resources.ResourceManager.GetString(endpointItemElement.Name);
                item.Tag         = endpointItemElement.Name;
                endPointsListView.Items.Add(item);
            }
            endpointsCountLabel.Text = String.Format(Properties.Resources.EndpointsFound, endpointCatalog.Count);
        }
예제 #8
0
 private void webServiceEnabledCheckBox_CheckedChanged(object sender, EventArgs e)
 {
     if (((CheckBox)sender).Checked)
     {
         Endpoint            endpoint        = new Endpoint("IntegerCalculatorEndpoint");
         EndpointSection     endpointSection = ConfigurationManager.GetSection("Endpoints") as EndpointSection;
         EndpointItemElement endpointConfig  = endpointSection.EndpointItemCollection.GetEndpoint("IntegerCalculatorEndpoint");
         endpoint.Default = new EndpointConfig(endpointConfig.Address);
         manager.EndpointCatalog.SetEndpoint(endpoint);
     }
     else
     {
         Endpoint endpoint = new Endpoint("IntegerCalculatorEndpoint");
         endpoint.Default = new EndpointConfig(ConfigurationManager.AppSettings["NonExistingURL"]);
         manager.EndpointCatalog.SetEndpoint(endpoint);
     }
 }
예제 #9
0
 /// <summary>
 /// Constructor for the factory with a section name.
 /// </summary>
 /// <param name="sectionName">Name for the section corresponding to the endpoint catalog in the configuration.</param>
 public EndpointCatalogFactory(string sectionName)
 {
     endpointSection = ConfigurationManager.GetSection(sectionName) as EndpointSection;
 }
        public void EndpointsAddressInEndpointCollectionAreTheSameThanAppConfig()
        {
            EndpointSection section = (EndpointSection)ConfigurationManager.GetSection("Endpoints");

            Assert.AreEqual("http://default/MyHost", section.EndpointItemCollection.GetEndpoint("MyHost").Address);
        }
        public void SectionGetEndpointItemsCollectionDoesntGetNull()
        {
            EndpointSection section = (EndpointSection)ConfigurationManager.GetSection("Endpoints");

            Assert.IsNotNull(section.EndpointItemCollection);
        }
        public void CountOfNetworkItemsInEndpointCollectionAreTheSameThanAppConfig()
        {
            EndpointSection section = (EndpointSection)ConfigurationManager.GetSection("Endpoints");

            Assert.AreEqual(2, section.EndpointItemCollection.GetEndpoint("MyHost").Networks.Count);
        }
        public void GetNetworkCollectionFromEndpointCollectionDoesntGetNull()
        {
            EndpointSection section = (EndpointSection)ConfigurationManager.GetSection("Endpoints");

            Assert.IsNotNull(section.EndpointItemCollection.GetEndpoint("MyHost").Networks);
        }