mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 14:07:46 +08:00
Update CsvConnectionsDeserializerMremotengFormatTests.cs
fix test
This commit is contained in:
@@ -13,10 +13,10 @@ using mRemoteNGTests.TestHelpers;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Csv;
|
||||
|
||||
public class CsvConnectionsDeserializerMremotengFormatTests
|
||||
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Csv
|
||||
{
|
||||
public class CsvConnectionsDeserializerMremotengFormatTests
|
||||
{
|
||||
private CsvConnectionsDeserializerMremotengFormat _deserializer;
|
||||
private CsvConnectionsSerializerMremotengFormat _serializer;
|
||||
|
||||
@@ -45,8 +45,7 @@ public class CsvConnectionsDeserializerMremotengFormatTests
|
||||
var deserializedConnections = _deserializer.Deserialize(csv);
|
||||
var connection = deserializedConnections.GetRecursiveChildList().FirstOrDefault();
|
||||
connection?.RemoveParent();
|
||||
var propertyValue = typeof(ConnectionInfoInheritance).GetProperty(propertyToCheck)
|
||||
?.GetValue(connection?.Inheritance);
|
||||
var propertyValue = typeof(ConnectionInfoInheritance).GetProperty(propertyToCheck)?.GetValue(connection?.Inheritance);
|
||||
return propertyValue;
|
||||
}
|
||||
|
||||
@@ -65,101 +64,10 @@ public class CsvConnectionsDeserializerMremotengFormatTests
|
||||
Assert.That(con1.Parent, Is.EqualTo(folder1));
|
||||
}
|
||||
|
||||
internal static ConnectionInfo GetTestConnection()
|
||||
private static ConnectionInfo GetTestConnection()
|
||||
{
|
||||
return new ConnectionInfo
|
||||
{
|
||||
Name = "SomeName",
|
||||
Description = "SomeDescription",
|
||||
Icon = "SomeIcon",
|
||||
Panel = "SomePanel",
|
||||
Username = "SomeUsername",
|
||||
Password = "SomePassword",
|
||||
Domain = "SomeDomain",
|
||||
Hostname = "SomeHostname",
|
||||
PuttySession = "SomePuttySession",
|
||||
LoadBalanceInfo = "SomeLoadBalanceInfo",
|
||||
OpeningCommand = "SomeOpeningCommand",
|
||||
PreExtApp = "SomePreExtApp",
|
||||
PostExtApp = "SomePostExtApp",
|
||||
MacAddress = "SomeMacAddress",
|
||||
UserField = "SomeUserField",
|
||||
VmId = "SomeVmId",
|
||||
ExtApp = "SomeExtApp",
|
||||
VNCProxyUsername = "SomeVNCProxyUsername",
|
||||
VNCProxyPassword = "SomeVNCProxyPassword",
|
||||
RDGatewayUsername = "SomeRDGatewayUsername",
|
||||
RDGatewayPassword = "SomeRDGatewayPassword",
|
||||
RDGatewayDomain = "SomeRDGatewayDomain",
|
||||
VNCProxyIP = "SomeVNCProxyIP",
|
||||
RDGatewayHostname = "SomeRDGatewayHostname",
|
||||
RDGatewayExternalCredentialProvider = ExternalCredentialProvider.None,
|
||||
RDGatewayUserViaAPI = "123",
|
||||
Protocol = ProtocolType.RDP,
|
||||
Port = 999,
|
||||
Favorite = true,
|
||||
UseConsoleSession = true,
|
||||
UseCredSsp = true,
|
||||
UseRestrictedAdmin = true,
|
||||
UseRCG = true,
|
||||
UseVmId = false,
|
||||
UseEnhancedMode = false,
|
||||
RenderingEngine = HTTPBase.RenderingEngine.EdgeChromium,
|
||||
RDPAuthenticationLevel = AuthenticationLevel.WarnOnFailedAuth,
|
||||
Colors = RDPColors.Colors16Bit,
|
||||
Resolution = RDPResolutions.Res1366x768,
|
||||
AutomaticResize = true,
|
||||
DisplayWallpaper = true,
|
||||
DisplayThemes = true,
|
||||
EnableFontSmoothing = true,
|
||||
EnableDesktopComposition = true,
|
||||
DisableFullWindowDrag = false,
|
||||
DisableMenuAnimations = false,
|
||||
DisableCursorShadow = false,
|
||||
DisableCursorBlinking = false,
|
||||
CacheBitmaps = true,
|
||||
RedirectDiskDrives = true,
|
||||
RedirectPorts = true,
|
||||
RedirectPrinters = true,
|
||||
RedirectSmartCards = true,
|
||||
RedirectSound = RDPSounds.LeaveAtRemoteComputer,
|
||||
RedirectAudioCapture = true,
|
||||
RedirectKeys = true,
|
||||
VNCCompression = ProtocolVNC.Compression.Comp4,
|
||||
VNCEncoding = ProtocolVNC.Encoding.EncRRE,
|
||||
VNCAuthMode = ProtocolVNC.AuthMode.AuthVNC,
|
||||
VNCProxyType = ProtocolVNC.ProxyType.ProxySocks5,
|
||||
VNCProxyPort = 123,
|
||||
VNCColors = ProtocolVNC.Colors.Col8Bit,
|
||||
VNCSmartSizeMode = ProtocolVNC.SmartSizeMode.SmartSAspect,
|
||||
VNCViewOnly = true,
|
||||
RDGatewayUsageMethod = RDGatewayUsageMethod.Detect,
|
||||
RDGatewayUseConnectionCredentials = RDGatewayUseConnectionCredentials.SmartCard,
|
||||
UserViaAPI = "",
|
||||
EC2InstanceId = "",
|
||||
EC2Region = "eu-central-1",
|
||||
ExternalAddressProvider = ExternalAddressProvider.None,
|
||||
ExternalCredentialProvider = ExternalCredentialProvider.None
|
||||
};
|
||||
}
|
||||
|
||||
internal static ConnectionInfo GetTestConnectionWithAllInherited()
|
||||
{
|
||||
var connectionInfo = new ConnectionInfo();
|
||||
connectionInfo.Inheritance.TurnOnInheritanceCompletely();
|
||||
return connectionInfo;
|
||||
}
|
||||
|
||||
private class DeserializationTestSource
|
||||
{
|
||||
public static IEnumerable ConnectionPropertyTestCases()
|
||||
private static ConnectionInfo GetTestConnection()
|
||||
{
|
||||
var ignoreProperties = new[]
|
||||
{
|
||||
nameof(ConnectionInfo.Inheritance),
|
||||
nameof(ConnectionInfo.ConstantID),
|
||||
nameof(ConnectionInfo.Parent)
|
||||
Name = "SomeName",
|
||||
Description = "SomeDescription",
|
||||
Icon = "SomeIcon",
|
||||
@@ -233,15 +141,8 @@ public class CsvConnectionsDeserializerMremotengFormatTests
|
||||
ExternalAddressProvider = ExternalAddressProvider.None,
|
||||
ExternalCredentialProvider = ExternalCredentialProvider.None
|
||||
};
|
||||
var properties = typeof(ConnectionInfo)
|
||||
.GetProperties()
|
||||
.Where(property => !ignoreProperties.Contains(property.Name));
|
||||
var testCases = new List<TestCaseData>();
|
||||
var testConnectionInfo = GetTestConnection();
|
||||
}
|
||||
|
||||
foreach (var property in properties)
|
||||
testCases.Add(
|
||||
new TestCaseData(property.Name)
|
||||
private static ConnectionInfo GetTestConnectionWithAllInherited()
|
||||
{
|
||||
var connectionInfo = new ConnectionInfo();
|
||||
|
||||
Reference in New Issue
Block a user