mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 14:07:46 +08:00
resolved failing tests
This commit is contained in:
@@ -34,39 +34,39 @@ namespace mRemoteNGTests.IntegrationTests
|
|||||||
* ------Connection2
|
* ------Connection2
|
||||||
* ----Connection3 (inherits username)
|
* ----Connection3 (inherits username)
|
||||||
*/
|
*/
|
||||||
var folder1 = new ContainerInfo {Username = "folder1User"};
|
var folder1 = new ContainerInfo { Icon = "someicon1" };
|
||||||
var folder2 = new ContainerInfo {Username = "folder2User"};
|
var folder2 = new ContainerInfo { Icon = "someicon2" };
|
||||||
var connection1 = new ConnectionInfo();
|
var connection1 = new ConnectionInfo();
|
||||||
var connection2 = new ConnectionInfo();
|
var connection2 = new ConnectionInfo();
|
||||||
var connection3 = new ConnectionInfo {Inheritance = {Username = true}};
|
var connection3 = new ConnectionInfo {Inheritance = {Icon = true}};
|
||||||
_rootNode.AddChild(folder1);
|
_rootNode.AddChild(folder1);
|
||||||
folder1.AddChildRange(new []{connection1, folder2, connection3});
|
folder1.AddChildRange(new []{connection1, folder2, connection3});
|
||||||
folder2.AddChild(connection2);
|
folder2.AddChild(connection2);
|
||||||
Assert.That(connection3.Username, Is.EqualTo(folder1.Username));
|
Assert.That(connection3.Icon, Is.EqualTo(folder1.Icon));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ConnectionWillInheritAllFromFolder()
|
public void ConnectionWillInheritAllFromFolder()
|
||||||
{
|
{
|
||||||
var folder = new ContainerInfo() {Protocol = ProtocolType.SSH2, Username = "folderUser", Domain = "CoolDomain"};
|
var folder = new ContainerInfo {Protocol = ProtocolType.SSH2, Icon = "someicon", CacheBitmaps = true};
|
||||||
var connection = new ConnectionInfo() {Inheritance = {EverythingInherited = true}};
|
var connection = new ConnectionInfo {Inheritance = {EverythingInherited = true}};
|
||||||
_rootNode.AddChild(folder);
|
_rootNode.AddChild(folder);
|
||||||
folder.AddChild(connection);
|
folder.AddChild(connection);
|
||||||
Assert.That(new object[] { connection.Protocol, connection.Username, connection.Domain }, Is.EquivalentTo(new object[] {folder.Protocol, folder.Username, folder.Domain}));
|
Assert.That(new object[] { connection.Protocol, connection.Icon, connection.CacheBitmaps }, Is.EquivalentTo(new object[] {folder.Protocol, folder.Icon, folder.CacheBitmaps }));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CanInheritThroughMultipleFolderLevels()
|
public void CanInheritThroughMultipleFolderLevels()
|
||||||
{
|
{
|
||||||
var folder1 = new ContainerInfo {Username = "folder1User"};
|
var folder1 = new ContainerInfo { Icon = "someicon"};
|
||||||
var folder2 = new ContainerInfo {Inheritance = {Username = true}};
|
var folder2 = new ContainerInfo {Inheritance = { Icon = true}};
|
||||||
var folder3 = new ContainerInfo {Inheritance = {Username = true}};
|
var folder3 = new ContainerInfo {Inheritance = { Icon = true}};
|
||||||
var connection = new ConnectionInfo {Inheritance = {Username = true}};
|
var connection = new ConnectionInfo {Inheritance = { Icon = true}};
|
||||||
_rootNode.AddChild(folder1);
|
_rootNode.AddChild(folder1);
|
||||||
folder1.AddChild(folder2);
|
folder1.AddChild(folder2);
|
||||||
folder2.AddChild(folder3);
|
folder2.AddChild(folder3);
|
||||||
folder3.AddChild(connection);
|
folder3.AddChild(connection);
|
||||||
Assert.That(connection.Username, Is.EqualTo(folder1.Username));
|
Assert.That(connection.Icon, Is.EqualTo(folder1.Icon));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,15 +47,15 @@ namespace mRemoteNG.Config.Serializers
|
|||||||
element.Add(new XAttribute("Id", connectionInfo.ConstantID));
|
element.Add(new XAttribute("Id", connectionInfo.ConstantID));
|
||||||
|
|
||||||
element.Add(_saveFilter.SaveUsername
|
element.Add(_saveFilter.SaveUsername
|
||||||
? new XAttribute("Username", connectionInfo.Username)
|
? new XAttribute("Username", connectionInfo.Username ?? "")
|
||||||
: new XAttribute("Username", ""));
|
: new XAttribute("Username", ""));
|
||||||
|
|
||||||
element.Add(_saveFilter.SaveDomain
|
element.Add(_saveFilter.SaveDomain
|
||||||
? new XAttribute("Domain", connectionInfo.Domain)
|
? new XAttribute("Domain", connectionInfo.Domain ?? "")
|
||||||
: new XAttribute("Domain", ""));
|
: new XAttribute("Domain", ""));
|
||||||
|
|
||||||
if (_saveFilter.SavePassword && !connectionInfo.Inheritance.Password)
|
if (_saveFilter.SavePassword && !connectionInfo.Inheritance.Password)
|
||||||
element.Add(new XAttribute("Password", _cryptographyProvider.Encrypt(connectionInfo.Password, _encryptionKey)));
|
element.Add(new XAttribute("Password", _cryptographyProvider.Encrypt(connectionInfo.Password, _encryptionKey) ?? ""));
|
||||||
else
|
else
|
||||||
element.Add(new XAttribute("Password", ""));
|
element.Add(new XAttribute("Password", ""));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user