public void CreateCatalogReturnsNullWhenConfigSectionDoesNotExist() { IEndpointCatalogFactory factory = new EndpointCatalogFactory("Non-ExistentEndpointSection"); EndpointCatalog catalog = factory.CreateCatalog() as EndpointCatalog; Assert.IsNull(catalog); }
public void GetAddressForEndpointFromDefaultValueThatDoesntExistThrowsAnException() { IEndpointCatalogFactory factory = new EndpointCatalogFactory("Endpoints"); EndpointCatalog catalog = factory.CreateCatalog() as EndpointCatalog; catalog.GetAddressForEndpoint("NoDefault", null); }
public void LoadEndpointCatalogFromConfigurationRetrievesValidCatalog() { IEndpointCatalogFactory factory = new EndpointCatalogFactory("Endpoints"); EndpointCatalog catalog = factory.CreateCatalog() as EndpointCatalog; Assert.AreEqual(2, catalog.Count); Assert.AreEqual("http://default/MyHost", catalog.GetAddressForEndpoint("MyHost", null)); Assert.AreEqual("defaultUser", catalog.GetCredentialForEndpoint("MyHost", null).UserName); Assert.AreEqual("4444", catalog.GetCredentialForEndpoint("MyHost", null).Password); Assert.AreEqual("http://internet/MyHost", catalog.GetAddressForEndpoint("MyHost", "Internet")); Assert.AreEqual("peter", catalog.GetCredentialForEndpoint("MyHost", "Internet").UserName); Assert.AreEqual("1234", catalog.GetCredentialForEndpoint("MyHost", "Internet").Password); Assert.AreEqual("myDomain", catalog.GetCredentialForEndpoint("MyHost", "Internet").Domain); Assert.AreEqual("http://work/MyHost", catalog.GetAddressForEndpoint("MyHost", "Work")); Assert.AreEqual("chris", catalog.GetCredentialForEndpoint("MyHost", "Work").UserName); Assert.AreEqual("3333", catalog.GetCredentialForEndpoint("MyHost", "Work").Password); Assert.AreEqual("http://internet/NoDefault", catalog.GetAddressForEndpoint("NoDefault", "Internet")); Assert.AreEqual("chris", catalog.GetCredentialForEndpoint("NoDefault", "Internet").UserName); Assert.AreEqual("1234", catalog.GetCredentialForEndpoint("NoDefault", "Internet").Password); Assert.AreEqual("http://work/NoDefault", catalog.GetAddressForEndpoint("NoDefault", "Work")); Assert.AreEqual("peter", catalog.GetCredentialForEndpoint("NoDefault", "Work").UserName); Assert.AreEqual("3333", catalog.GetCredentialForEndpoint("NoDefault", "Work").Password); Assert.AreEqual("MyDomain", catalog.GetCredentialForEndpoint("NoDefault", "Work").Domain); }
public void LoadEndpointCatalogFromConfigurationRetrievesACatalog() { IEndpointCatalogFactory factory = new EndpointCatalogFactory("Endpoints"); EndpointCatalog catalog = factory.CreateCatalog() as EndpointCatalog; Assert.IsNotNull(catalog); }
private EndpointCatalog CreateEndpointCatalog() { EndpointCatalog catalog; //using (TestResourceFile resFile = new TestResourceFile(this, @"App.config")) //{ IEndpointCatalogFactory factory = new EndpointCatalogFactory("Endpoints"); catalog = factory.CreateCatalog() as EndpointCatalog; //} return(catalog); }
private static RequestManager InitializeManager(SmartClientDatabase db) { DatabaseRequestQueue requestQueue = new DatabaseRequestQueue(db, "Requests"); DatabaseRequestQueue deadLetterQueue = new DatabaseRequestQueue(db, "DeadLetter"); ConnectionMonitor.ConnectionMonitor monitor = ConnectionMonitorFactory.CreateFromConfiguration(); ConnectionMonitorAdapter monitorAdapter = new ConnectionMonitorAdapter(monitor); IEndpointCatalog endpointCatalog = new EndpointCatalogFactory("Endpoints").CreateCatalog(); // nothing is defined in config. Create an empty catalog if (endpointCatalog == null) { endpointCatalog = new EndpointCatalog.EndpointCatalog(); } RequestManager manager = RequestManager.Instance; manager.Initialize(requestQueue, deadLetterQueue, monitorAdapter, endpointCatalog); return(manager); }
public void EndpointCatalogFactoryConstructorDoesNotThrowsWhenSectionDoesNotExist() { IEndpointCatalogFactory factory = new EndpointCatalogFactory("Non-ExistentEndpointSection"); }