mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
resolved the issue with inheritance not being applied correctly for folders. created a few tests to help guard against this from happening again.
This commit is contained in:
@@ -97,6 +97,16 @@ namespace mRemoteNGTests.Config.Serializers
|
||||
Assert.That(connectionCount, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[TestCaseSource(typeof(XmlConnectionsDeserializerFixtureData), nameof(XmlConnectionsDeserializerFixtureData.FixtureParams))]
|
||||
public void Folder22InheritsUsername(Datagram testData)
|
||||
{
|
||||
Setup(testData.ConfCons, testData.Password);
|
||||
var connectionRoot = _connectionTreeModel.RootNodes[0];
|
||||
var folder2 = GetFolderNamed("Folder2", connectionRoot.Children);
|
||||
var folder22 = GetFolderNamed("Folder2.2", folder2.Children);
|
||||
Assert.That(folder22.Inheritance.Username, Is.True);
|
||||
}
|
||||
|
||||
private bool ContainsNodeNamed(string name, IEnumerable<ConnectionInfo> list)
|
||||
{
|
||||
return list.Any(node => node.Name == name);
|
||||
|
||||
@@ -56,6 +56,15 @@ namespace mRemoteNGTests.Connection
|
||||
Assert.That(_connectionInfo.Domain, Is.EqualTo(secondConnection.Domain));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyingAConnectionInfoAlsoCopiesItsInheritance()
|
||||
{
|
||||
_connectionInfo.Inheritance.Username = true;
|
||||
var secondConnection = new ConnectionInfo {Inheritance = {Username = false}};
|
||||
secondConnection.CopyFrom(_connectionInfo);
|
||||
Assert.That(secondConnection.Inheritance.Username, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PropertyChangedEventRaisedWhenOpenConnectionsChanges()
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace mRemoteNG.Connection
|
||||
return newConnectionInfo;
|
||||
}
|
||||
|
||||
public void CopyFrom(AbstractConnectionInfoData sourceConnectionInfo)
|
||||
public void CopyFrom(ConnectionInfo sourceConnectionInfo)
|
||||
{
|
||||
var properties = typeof(AbstractConnectionInfoData).GetProperties();
|
||||
foreach (var property in properties)
|
||||
@@ -91,7 +91,10 @@ namespace mRemoteNG.Connection
|
||||
var remotePropertyValue = property.GetValue(sourceConnectionInfo, null);
|
||||
property.SetValue(this, remotePropertyValue, null);
|
||||
}
|
||||
}
|
||||
var clonedInheritance = sourceConnectionInfo.Inheritance.Clone();
|
||||
clonedInheritance.Parent = this;
|
||||
Inheritance = clonedInheritance;
|
||||
}
|
||||
|
||||
public virtual TreeNodeType GetTreeNodeType()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user