Download PowerShell-master/test/xUnit/csharp/test_CommandLineParser.cs from MegaBites-AI/Windows-powershell: direct link, hf CLI and curl.
- Browser
- Download file 50.1 kB
-
https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/xUnit/csharp/test_CommandLineParser.cs
- Command line
-
hf download hf://datasets/MegaBites-AI/Windows-powershell/PowerShell-master/test/xUnit/csharp/test_CommandLineParser.cs
-
curl -L -o test_CommandLineParser.cs https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/xUnit/csharp/test_CommandLineParser.cs
50.1 kB
| // Copyright (c) Microsoft Corporation. | |
| // Licensed under the MIT License. | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.IO; | |
| using System.Management.Automation; | |
| using Microsoft.PowerShell; | |
| using Xunit; | |
| namespace PSTests.Parallel | |
| { | |
| public static class PSCommandLineParserTests | |
| { | |
| [] | |
| public static void TestDefaults() | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(System.Array.Empty<string>()); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.Empty(cpp.Args); | |
| Assert.Null(cpp.ConfigurationName); | |
| Assert.Null(cpp.ConfigurationFile); | |
| Assert.Null(cpp.CustomPipeName); | |
| Assert.Null(cpp.ErrorMessage); | |
| Assert.Null(cpp.ExecutionPolicy); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeSuccess, cpp.ExitCode); | |
| Assert.False(cpp.ExplicitReadCommandsFromStdin); | |
| Assert.Null(cpp.File); | |
| Assert.Null(cpp.InitialCommand); | |
| Assert.Equal(Microsoft.PowerShell.Serialization.DataFormat.Text, cpp.InputFormat); | |
| Assert.False(cpp.NamedPipeServerMode); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.NonInteractive); | |
| Assert.False(cpp.NoPrompt); | |
| Assert.Equal(Microsoft.PowerShell.Serialization.DataFormat.Text, cpp.OutputFormat); | |
| Assert.False(cpp.OutputFormatSpecified); | |
| Assert.False(cpp.RemoveWorkingDirectoryTrailingCharacter); | |
| Assert.False(cpp.ServerMode); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowVersion); | |
| Assert.False(cpp.SkipProfiles); | |
| Assert.False(cpp.SocketServerMode); | |
| Assert.False(cpp.V2SocketServerMode); | |
| Assert.False(cpp.SSHServerMode); | |
| if (Platform.IsWindows) | |
| { | |
| Assert.True(cpp.StaMode); | |
| } | |
| else | |
| { | |
| Assert.False(cpp.StaMode); | |
| } | |
| Assert.False(cpp.ThrowOnReadAndPrompt); | |
| Assert.False(cpp.WasInitialCommandEncoded); | |
| Assert.Null(cpp.WorkingDirectory); | |
| Assert.False(cpp.NonInteractive); | |
| } | |
| [] | |
| public static void Test_Throws_On_Reuse() | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(System.Array.Empty<string>()); | |
| Assert.Throws<System.InvalidOperationException>(() => cpp.Parse(System.Array.Empty<string>())); | |
| } | |
| [] | |
| [] | |
| public static void Test_ARGS_With_Null(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| Assert.Throws<System.ArgumentNullException>(() => cpp.Parse(commandLine)); | |
| } | |
| [] | |
| [] | |
| public static void TestDefaultParameterIsFileName_Not_Exist(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.False(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal(CommandLineParameterParser.NormalizeFilePath("noexistfilename"), cpp.File); | |
| Assert.Equal( | |
| string.Format(CommandLineParameterParserStrings.ArgumentFileDoesNotExist, "noexistfilename"), | |
| cpp.ErrorMessage); | |
| } | |
| [] | |
| public static void TestDefaultParameterIsFileName_Exist() | |
| { | |
| var tempFile = System.IO.Path.GetTempFileName(); | |
| var tempPs1 = tempFile + ".ps1"; | |
| File.Move(tempFile, tempPs1); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(new string[] { tempPs1 }); | |
| try | |
| { | |
| Assert.False(cpp.AbortStartup); | |
| Assert.False(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal(CommandLineParameterParser.NormalizeFilePath(tempPs1), cpp.File); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| finally | |
| { | |
| File.Delete(tempPs1); | |
| } | |
| } | |
| [] | |
| [] | |
| public static void TestParameterIsFileName_Dash(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.False(cpp.NoPrompt); | |
| Assert.True(cpp.ExplicitReadCommandsFromStdin); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| public static void TestParameterIs_Wrong_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.False(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.False(cpp.NoPrompt); | |
| Assert.Contains(commandLine[0], cpp.ErrorMessage); | |
| Assert.Contains("-noprofile", cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_Dash_Or_Slash(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.False(cpp.NoExit); | |
| Assert.True(cpp.NonInteractive); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.NoPrompt); | |
| Assert.True(cpp.ShowVersion); | |
| Assert.True(cpp.SkipProfiles); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_Wrong_Dash_And_Slash(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.False(cpp.NoExit); | |
| Assert.False(cpp.NonInteractive); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.NoPrompt); | |
| Assert.False(cpp.ShowVersion); | |
| Assert.False(cpp.SkipProfiles); | |
| Assert.Contains(commandLine[0], cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] // Ignore all after the parameter | |
| public static void TestParameter_Version(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.False(cpp.NoExit); | |
| Assert.True(cpp.NonInteractive); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.True(cpp.ShowVersion); | |
| Assert.True(cpp.SkipProfiles); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_Help(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowExtendedHelp); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_Login(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| // Parser does not change any internal properties for the parameter. | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_NoExit(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_NoProfile(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.True(cpp.SkipProfiles); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_NoLogo(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_NoInteractive(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.True(cpp.NonInteractive); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_SocketServerMode(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.True(cpp.SocketServerMode); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_V2SocketServerMode(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.True(cpp.V2SocketServerMode); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_ServerMode(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.True(cpp.ServerMode); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_NamedPipeServerMode(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.True(cpp.NamedPipeServerMode); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_SSHServerMode(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.True(cpp.SSHServerMode); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_Interactive(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.False(cpp.NonInteractive); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_ConfigurationName_No_Name(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MissingConfigurationNameArgument, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_ConfigurationName_With_Name(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Equal("qwerty", cpp.ConfigurationName); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| public static void TestParameter_ConfigurationFile_No_Name(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MissingConfigurationFileArgument, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| public static void TestParameter_ConfigurationFile_With_Name(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Equal("qwerty", cpp.ConfigurationFile); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_CustomPipeName_No_Name(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MissingCustomPipeNameArgument, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_CustomPipeName_With_Name(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Equal("qwerty", cpp.CustomPipeName); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| public static System.Collections.Generic.IEnumerable<object[]> Data => | |
| new System.Collections.Generic.List<string[]> | |
| { | |
| new string[] { "-custompipename", new string('q', CommandLineParameterParser.MaxNameLength() + 1) } | |
| }; | |
| [] | |
| [] | |
| public static void TestParameter_CustomPipeName_With_Too_Long_Name(params string[] commandLine) | |
| { | |
| Skip.If(Platform.IsWindows); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal( | |
| string.Format( | |
| CommandLineParameterParserStrings.CustomPipeNameTooLong, | |
| CommandLineParameterParser.MaxNameLength(), | |
| commandLine[1], | |
| commandLine[1].Length), | |
| cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_Command_No_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MissingCommandParameter, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_Command_With_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.False(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal("qwerty", cpp.InitialCommand); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_Command_With_Dash_And_Not_ConsoleInputRedirected(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.InputRedirectedTestHook = false; | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.True(cpp.NoPrompt); | |
| Assert.True(cpp.ExplicitReadCommandsFromStdin); | |
| Assert.Equal(CommandLineParameterParserStrings.StdinNotRedirected, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_Command_With_Dash_And_Tail(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.TooManyParametersToCommand, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_Command_With_Dash_And_ConsoleInputRedirected(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.InputRedirectedTestHook = true; | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeSuccess, cpp.ExitCode); | |
| Assert.True(cpp.ExplicitReadCommandsFromStdin); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_WindowsStyle_On_Unix(params string[] commandLine) | |
| { | |
| Skip.If(Platform.IsWindows); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.WindowStyleArgumentNotImplemented, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_WindowsStyle_No_Value(params string[] commandLine) | |
| { | |
| Skip.IfNot(Platform.IsWindows); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MissingWindowStyleArgument, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_WindowsStyle_With_Wrong_Value(params string[] commandLine) | |
| { | |
| Skip.IfNot(Platform.IsWindows); | |
| string errorMessage = null; | |
| try | |
| { | |
| ProcessWindowStyle style = (ProcessWindowStyle)LanguagePrimitives.ConvertTo( | |
| commandLine[1], typeof(ProcessWindowStyle), System.Globalization.CultureInfo.InvariantCulture); | |
| } | |
| catch (PSInvalidCastException e) | |
| { | |
| errorMessage = e.Message; | |
| } | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal( | |
| string.Format(CommandLineParameterParserStrings.InvalidWindowStyleArgument, commandLine[1], errorMessage), | |
| cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_WindowsStyle_With_Right_Value(params string[] commandLine) | |
| { | |
| Skip.IfNot(Platform.IsWindows); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeSuccess, cpp.ExitCode); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_OutputFormat_No_Value(params string[] commandLine) | |
| { | |
| var index = CommandLineParameterParserStrings.MissingOutputFormatParameter.IndexOf('.'); | |
| var errorMessage = CommandLineParameterParserStrings.MissingOutputFormatParameter.Substring(0, index); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(errorMessage, cpp.ErrorMessage.Substring(0, index)); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_OutputFormat_With_Wrong_Value(params string[] commandLine) | |
| { | |
| var index = CommandLineParameterParserStrings.BadFormatParameterValue.IndexOf('.'); | |
| var errorMessage = CommandLineParameterParserStrings.BadFormatParameterValue.Substring(0, index); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(errorMessage, cpp.ErrorMessage.Substring(0, index)); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_OutputFormat_With_Right_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Equal(Microsoft.PowerShell.Serialization.DataFormat.XML, cpp.OutputFormat); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeSuccess, cpp.ExitCode); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_InputFormat_No_Value(params string[] commandLine) | |
| { | |
| var index = CommandLineParameterParserStrings.MissingInputFormatParameter.IndexOf('.'); | |
| var errorMessage = CommandLineParameterParserStrings.MissingInputFormatParameter.Substring(0, index); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(errorMessage, cpp.ErrorMessage.Substring(0, index)); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_InputFormat_With_Wrong_Value(params string[] commandLine) | |
| { | |
| var index = CommandLineParameterParserStrings.BadFormatParameterValue.IndexOf('.'); | |
| var errorMessage = CommandLineParameterParserStrings.BadFormatParameterValue.Substring(0, index); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(errorMessage, cpp.ErrorMessage.Substring(0, index)); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_InputFormat_With_Right_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.Equal(commandLine[1], cpp.InputFormat.ToString()); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Equal(Microsoft.PowerShell.Serialization.DataFormat.XML, cpp.InputFormat); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeSuccess, cpp.ExitCode); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_ExecutionPolicy_No_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MissingExecutionPolicyParameter, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_ExecutionPolicy_With_Wrong_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(commandLine[1], cpp.ExecutionPolicy); | |
| Assert.Equal( | |
| string.Format(CommandLineParameterParserStrings.InvalidExecutionPolicyArgument, "InvalidPolicy"), | |
| cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_EncodedCommand_No_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MissingCommandParameter, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] // 'abbra' in Base64 format | |
| [] | |
| [] | |
| public static void TestParameter_EncodedCommand_With_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.False(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal("abbra", cpp.InitialCommand); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_EncodedCommand_With_Dash(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.False(cpp.NoPrompt); | |
| Assert.False(cpp.ExplicitReadCommandsFromStdin); | |
| Assert.Equal(CommandLineParameterParserStrings.BadCommandValue, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_EncodedCommand_With_Dash_And_Tail(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.BadCommandValue, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_EncodedCommand_With_Dash_And_ConsoleInputRedirected(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.InputRedirectedTestHook = true; | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.False(cpp.ExplicitReadCommandsFromStdin); | |
| Assert.Equal(CommandLineParameterParserStrings.BadCommandValue, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_EncodedArguments_No_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MissingArgsValue, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_EncodedArguments_With_Wrong_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.True(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.BadArgsValue, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] // '-abbra' in Base64 format | |
| [] | |
| [] | |
| public static void TestParameter_EncodedArguments_With_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.Null(cpp.ErrorMessage); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Equal("-abbra", cpp.Args[0].Value); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_SettingsFile_No_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MissingSettingsFileArgument, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_SettingsFile_Not_Exists(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal( | |
| string.Format(CommandLineParameterParserStrings.SettingsFileNotExists, Path.GetFullPath("noexistfilename")), | |
| cpp.ErrorMessage); | |
| } | |
| public class TestDataSettingsFile : IEnumerable<object[]> | |
| { | |
| private readonly string _fileName = Path.GetTempFileName(); | |
| public IEnumerator<object[]> GetEnumerator() | |
| { | |
| yield return new object[] { "-settingsfile", _fileName }; | |
| yield return new object[] { "-settings", _fileName }; | |
| } | |
| IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | |
| } | |
| [] | |
| [] | |
| public static void TestParameter_SettingsFile_Exists(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeSuccess, cpp.ExitCode); | |
| Assert.Null(cpp.ErrorMessage); | |
| Assert.Equal(commandLine[1], cpp.SettingsFile); | |
| } | |
| [] | |
| [] | |
| public static void TestParameter_STA_Not_IsWindowsDesktop(params string[] commandLine) | |
| { | |
| Skip.If(Platform.IsWindowsDesktop); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.STANotImplemented, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| public static void TestParameter_STA_And_MTA_Mutually_Exclusive(params string[] commandLine) | |
| { | |
| Skip.IfNot(Platform.IsWindows); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MtaStaMutuallyExclusive, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| public static void TestParameter_STA(params string[] commandLine) | |
| { | |
| Skip.IfNot(Platform.IsWindows); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.True(cpp.StaMode); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| public static void TestParameter_MTA_Not_IsWindowsDesktop(params string[] commandLine) | |
| { | |
| Skip.If(Platform.IsWindowsDesktop); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MTANotImplemented, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| public static void TestParameter_MTA_And_STA_Mutually_Exclusive(params string[] commandLine) | |
| { | |
| Skip.IfNot(Platform.IsWindows); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MtaStaMutuallyExclusive, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| public static void TestParameter_MTA(params string[] commandLine) | |
| { | |
| Skip.IfNot(Platform.IsWindows); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.False(cpp.StaMode); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_WorkingDirectory_No_Value(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.True(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| Assert.Equal((uint)ConsoleHost.ExitCodeBadCommandLineParameter, cpp.ExitCode); | |
| Assert.Equal(CommandLineParameterParserStrings.MissingWorkingDirectoryArgument, cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_WorkingDirectory(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Equal(commandLine[1], cpp.WorkingDirectory); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| [] | |
| [] | |
| [] | |
| [] | |
| public static void TestParameter_WorkingDirectory_RemoveTrailingCharacter(params string[] commandLine) | |
| { | |
| Skip.IfNot(Platform.IsWindows); | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| Assert.False(cpp.AbortStartup); | |
| Assert.True(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.True(cpp.ShowBanner); | |
| Assert.Equal(commandLine[1].Remove(commandLine[1].Length - 1), cpp.WorkingDirectory); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| public class TestDataLastFile : IEnumerable<object[]> | |
| { | |
| private static string _fileName | |
| { | |
| get | |
| { | |
| var tempFile = Path.GetTempFileName(); | |
| var tempPs1 = tempFile + ".ps1"; | |
| File.Move(tempFile, tempPs1); | |
| return tempPs1; | |
| } | |
| } | |
| public IEnumerator<object[]> GetEnumerator() | |
| { | |
| yield return new object[] { "-noprofile", _fileName }; | |
| } | |
| IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | |
| } | |
| [] | |
| [] | |
| public static void TestParameter_LastParameterIsFileName_Exist(params string[] commandLine) | |
| { | |
| var cpp = new CommandLineParameterParser(); | |
| cpp.Parse(commandLine); | |
| try | |
| { | |
| Assert.False(cpp.AbortStartup); | |
| Assert.False(cpp.NoExit); | |
| Assert.False(cpp.ShowShortHelp); | |
| Assert.False(cpp.ShowBanner); | |
| if (Platform.IsWindows) | |
| { | |
| Assert.True(cpp.StaMode); | |
| } | |
| else | |
| { | |
| Assert.False(cpp.StaMode); | |
| } | |
| Assert.Equal(CommandLineParameterParser.NormalizeFilePath(commandLine[commandLine.Length - 1]), cpp.File); | |
| Assert.Null(cpp.ErrorMessage); | |
| } | |
| finally | |
| { | |
| File.Delete(cpp.File); | |
| } | |
| } | |
| } | |
| } | |