From e723a5345be26b313b66710d22d3b0df60306742 Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Thu, 16 Nov 2023 15:22:20 -0600 Subject: [PATCH] Scaffold tests for cmdlets --- LANCommander.PowerShell.Tests/Cmdlets.cs | 36 +++++++++ .../LANCommander.PowerShell.Tests.csproj | 75 +++++++++++++++++++ .../Properties/AssemblyInfo.cs | 20 +++++ LANCommander.PowerShell.Tests/packages.config | 5 ++ LANCommander.sln | 6 ++ 5 files changed, 142 insertions(+) create mode 100644 LANCommander.PowerShell.Tests/Cmdlets.cs create mode 100644 LANCommander.PowerShell.Tests/LANCommander.PowerShell.Tests.csproj create mode 100644 LANCommander.PowerShell.Tests/Properties/AssemblyInfo.cs create mode 100644 LANCommander.PowerShell.Tests/packages.config diff --git a/LANCommander.PowerShell.Tests/Cmdlets.cs b/LANCommander.PowerShell.Tests/Cmdlets.cs new file mode 100644 index 0000000..062dc71 --- /dev/null +++ b/LANCommander.PowerShell.Tests/Cmdlets.cs @@ -0,0 +1,36 @@ +using LANCommander.PowerShell.Cmdlets; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Linq; + +namespace LANCommander.PowerShell.Tests +{ + [TestClass] + public class CmdletTests + { + [TestMethod] + public void ConvertToSerializedBase64ShouldBeDeserializable() + { + var testPhrase = "Hello world! This should be deserializable back to its original form."; + + var encodingCmdlet = new ConvertToSerializedBase64Cmdlet() + { + Input = testPhrase + }; + + var encodingResults = encodingCmdlet.Invoke().OfType().ToList(); + + Assert.AreEqual(1, encodingResults.Count); + + var decodingCmdlet = new ConvertFromSerializedBase64Cmdlet() + { + Input = encodingResults.First() + }; + + var decodingResults = decodingCmdlet.Invoke().OfType().ToList(); + + Assert.AreEqual(1, encodingResults.Count); + Assert.AreEqual(testPhrase, decodingResults.First()); + } + } +} diff --git a/LANCommander.PowerShell.Tests/LANCommander.PowerShell.Tests.csproj b/LANCommander.PowerShell.Tests/LANCommander.PowerShell.Tests.csproj new file mode 100644 index 0000000..af5df94 --- /dev/null +++ b/LANCommander.PowerShell.Tests/LANCommander.PowerShell.Tests.csproj @@ -0,0 +1,75 @@ + + + + + + Debug + AnyCPU + {D7069A13-F0AA-4CBF-9013-4276F130A6DD} + Library + Properties + LANCommander.PowerShell.Tests + LANCommander.PowerShell.Tests + v4.6.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + + + + + + + + + {807943bf-0c7d-4ed3-8393-cfee64e3138c} + LANCommander.PowerShell + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/LANCommander.PowerShell.Tests/Properties/AssemblyInfo.cs b/LANCommander.PowerShell.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..82c8b70 --- /dev/null +++ b/LANCommander.PowerShell.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("LANCommander.PowerShell.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LANCommander.PowerShell.Tests")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("d7069a13-f0aa-4cbf-9013-4276f130a6dd")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LANCommander.PowerShell.Tests/packages.config b/LANCommander.PowerShell.Tests/packages.config new file mode 100644 index 0000000..e47cc4d --- /dev/null +++ b/LANCommander.PowerShell.Tests/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/LANCommander.sln b/LANCommander.sln index 5f6fef2..f77170c 100644 --- a/LANCommander.sln +++ b/LANCommander.sln @@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander.PCGamingWiki", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LANCommander.PowerShell", "LANCommander.PowerShell\LANCommander.PowerShell.csproj", "{807943BF-0C7D-4ED3-8393-CFEE64E3138C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LANCommander.PowerShell.Tests", "LANCommander.PowerShell.Tests\LANCommander.PowerShell.Tests.csproj", "{D7069A13-F0AA-4CBF-9013-4276F130A6DD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {807943BF-0C7D-4ED3-8393-CFEE64E3138C}.Debug|Any CPU.Build.0 = Debug|Any CPU {807943BF-0C7D-4ED3-8393-CFEE64E3138C}.Release|Any CPU.ActiveCfg = Release|Any CPU {807943BF-0C7D-4ED3-8393-CFEE64E3138C}.Release|Any CPU.Build.0 = Release|Any CPU + {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7069A13-F0AA-4CBF-9013-4276F130A6DD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE