Update CsvConnectionsDeserializerMremotengFormatTests.cs

fix test
This commit is contained in:
BlueBlock
2023-03-23 17:47:27 -04:00
parent f47434c09e
commit 9f0cfd5f22

View File

@@ -13,8 +13,8 @@ using mRemoteNGTests.TestHelpers;
using NSubstitute;
using NUnit.Framework;
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Csv;
namespace mRemoteNGTests.Config.Serializers.ConnectionSerializers.Csv
{
public class CsvConnectionsDeserializerMremotengFormatTests
{
private CsvConnectionsDeserializerMremotengFormat _deserializer;
@@ -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();