private void QuickStartForm_Load(object sender, EventArgs e) { ConnectionMonitorFactory.CreateFromConfiguration(); LoadConnectionsAndNetworks(); validateAddNetwork(); }
public void ReadingConfigurationWithDuplicatedNetworks() { using (new ConnectionMonitorFactoryReset()) { ConnectionMonitorFactory.CreateFromConfiguration("DuplicatedNetworks"); } }
public void TestAddConnectionToConstructedMonitor() { using (new ConnectionMonitorFactoryReset()) { NicConnection objNIC = new WiredConnection("Local Area Connection", 100); ConnectionMonitor objConMonitor1; objConMonitor1 = ConnectionMonitorFactory.CreateFromConfiguration(); ConnectionCollection objConnColl1; objConnColl1 = objConMonitor1.Connections; objConnColl1.Add(objNIC); // 3 from config plus the one just added Assert.AreEqual(4, objConnColl1.Count); } }
public void InitializeFromDefault() { using (new ConnectionMonitorFactoryReset()) { ConnectionMonitor monitor = ConnectionMonitorFactory.CreateFromConfiguration(); Assert.AreEqual(3, monitor.Connections.Count); Assert.IsTrue(monitor.Connections.Contains("WiredConnection")); Assert.IsTrue(monitor.Connections.Contains("WirelessConnection")); Assert.IsTrue(monitor.Connections.Contains("DesktopConnection")); Assert.AreEqual(3, monitor.Networks.Count); Assert.IsTrue(monitor.Networks.Contains("Internet")); Assert.IsTrue(monitor.Networks.Contains("Work")); Assert.IsTrue(monitor.Networks.Contains("Home")); Assert.AreSame(monitor, ConnectionMonitorFactory.Instance); } }
public void CanCreateNonIncludedType() { using (new ConnectionMonitorFactoryReset()) { ConnectionMonitor monitor = ConnectionMonitorFactory.CreateFromConfiguration("CustomConnection"); Assert.AreEqual(4, monitor.Connections.Count); Assert.IsTrue(monitor.Connections.Contains("WiredConnection")); Assert.IsTrue(monitor.Connections.Contains("WirelessConnection")); Assert.IsTrue(monitor.Connections.Contains("DesktopConnection")); Assert.IsTrue(monitor.Connections.Contains("MyCustomConnection")); Assert.AreEqual(3, monitor.Networks.Count); Assert.IsTrue(monitor.Networks.Contains("Internet")); Assert.IsTrue(monitor.Networks.Contains("Work")); Assert.IsTrue(monitor.Networks.Contains("Home")); Assert.AreSame(monitor, ConnectionMonitorFactory.Instance); } }
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); }