public void ConnectionInformation_WithLoginInformation()
{
// Setup
var userName = "******";
var passwordUnsecure = "admin";
var password = passwordUnsecure.ConvertToSecureString();
var serverUri = new Uri("http://localhost/");
var testSubject = new ConnectionInformation(serverUri, userName, password);
// Act
password.Dispose(); // Connection information should maintain it's own copy of the password
// Verify
Assert.AreEqual(passwordUnsecure, testSubject.Password.ConvertToUnsecureString(), "Password doesn't match");
Assert.AreEqual(userName, testSubject.UserName, "UserName doesn't match");
Assert.AreEqual(serverUri, testSubject.ServerUri, "ServerUri doesn't match");
// Act clone
var testSubject2 = (ConnectionInformation)((ICloneable)testSubject).Clone();
// Now dispose the test subject
testSubject.Dispose();
// Verify testSubject
Exceptions.Expect<ObjectDisposedException>(() => testSubject.Password.ConvertToUnsecureString());
// Verify testSubject2
Assert.AreEqual(passwordUnsecure, testSubject2.Password.ConvertToUnsecureString(), "Password doesn't match");
Assert.AreEqual(userName, testSubject2.UserName, "UserName doesn't match");
Assert.AreEqual(serverUri, testSubject2.ServerUri, "ServerUri doesn't match");
}