mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
Removed unnecessary XenConnection constructor which was there only to be used by the tests; used an object initialiser instead.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
c294e6514a
commit
d83b91a987
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -266,20 +266,6 @@ namespace XenAdmin.Network
|
||||
cacheUpdateTimer = new System.Threading.Timer(cacheUpdater);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used by the automated tests. Initializes a new instance of the <see cref="XenConnection"/> class.
|
||||
/// <param name="hostname"></param>
|
||||
/// <param name="friendlyName"></param>
|
||||
/// </summary>
|
||||
public XenConnection(string hostname, string friendlyName)
|
||||
: this()
|
||||
{
|
||||
this.Hostname = hostname;
|
||||
this.FriendlyName = friendlyName;
|
||||
this.Port = 443;
|
||||
this.SaveDisconnected = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For use by unit tests only.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user