diff --git a/XenAdminTests/MainWindowLauncher.cs b/XenAdminTests/MainWindowLauncher.cs index 19aa689ae..9b714f7bc 100644 --- a/XenAdminTests/MainWindowLauncher.cs +++ b/XenAdminTests/MainWindowLauncher.cs @@ -148,13 +148,18 @@ namespace XenAdminTests return LoadDB(name, "root"); } - protected IXenConnection LoadDB(string name, string username) + private IXenConnection LoadDB(string name, string username) { - string fileName = TestResource(name); + var connection = new XenConnection + { + Username = username, + Password = "", + Hostname = TestResource(name), + FriendlyName = name, + Port = 443, + SaveDisconnected = true + }; - IXenConnection connection = new XenConnection(fileName, name); - connection.Username = username; - connection.Password = ""; lock (ConnectionsManager.ConnectionsLock) { ConnectionsManager.XenConnections.Add(connection); diff --git a/XenAdminTests/TestDatabaseManager.cs b/XenAdminTests/TestDatabaseManager.cs index 77bcfb216..5a373155f 100644 --- a/XenAdminTests/TestDatabaseManager.cs +++ b/XenAdminTests/TestDatabaseManager.cs @@ -158,12 +158,19 @@ namespace XenAdminTests private void CreateNewConnection(string dbFileName, string username, string password) { string fileName = TestResource(dbFileName); - Assert.True(File.Exists(fileName), String.Format("Provided filename does not exist: '{0}'. " + - "If this is a new file, maybe the 'Copy To Ouput Directory' property has not been set", - fileName)); + Assert.True(File.Exists(fileName), + String.Format("Provided filename does not exist: '{0}'. " + + "If this is a new file, maybe the 'Copy To Ouput Directory' property has not been set", + fileName)); XenAdminConfigManager.Provider = new TestXenAdminConfigProvider(); - IXenConnection connection = new XenConnection(fileName, dbFileName); + var connection = new XenConnection + { + Hostname = fileName, + FriendlyName = dbFileName, + Port = 443, + SaveDisconnected = true + }; ServicePointManager.DefaultConnectionLimit = 20; ServicePointManager.ServerCertificateValidationCallback = SSL.ValidateServerCertificate; diff --git a/XenModel/Network/XenConnection.cs b/XenModel/Network/XenConnection.cs index 1f75bb96c..922275345 100644 --- a/XenModel/Network/XenConnection.cs +++ b/XenModel/Network/XenConnection.cs @@ -266,20 +266,6 @@ namespace XenAdmin.Network cacheUpdateTimer = new System.Threading.Timer(cacheUpdater); } - /// - /// Used by the automated tests. Initializes a new instance of the class. - /// - /// - /// - public XenConnection(string hostname, string friendlyName) - : this() - { - this.Hostname = hostname; - this.FriendlyName = friendlyName; - this.Port = 443; - this.SaveDisconnected = true; - } - /// /// For use by unit tests only. ///