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:
David Sparer
2016-11-15 10:15:49 -07:00
parent 0391eabc79
commit 7ba7e0b2d8
3 changed files with 24 additions and 2 deletions

View File

@@ -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);

View File

@@ -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()
{

View File

@@ -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()
{