diff --git a/.github/workflows/dotnet-desktop-ci.yml b/.github/workflows/dotnet-desktop-ci.yml index 3b6e2da..e57b58a 100644 --- a/.github/workflows/dotnet-desktop-ci.yml +++ b/.github/workflows/dotnet-desktop-ci.yml @@ -29,10 +29,10 @@ jobs: dotnet-version: '8.0.x' - name: Build - run: dotnet build $env:Project_File -c Release -f net8.0-windows -r win-${{ matrix.targetplatform }} --self-contained true + run: dotnet build $env:Project_File -c Release -f net8.0-windows -r win-${{ matrix.targetplatform }} - name: Publish Artifact - run: dotnet publish -c Release -f net8.0-windows -r win-${{ matrix.targetplatform }} -o ./FAFB_PowerShell_Tool_${{ matrix.targetplatform }} --self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=embedded + run: dotnet publish -c Release -f net8.0-windows -r win-${{ matrix.targetplatform }} -o ./FAFB_PowerShell_Tool_${{ matrix.targetplatform }} --self-contained true -p:PublishSingleFile=false -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=embedded - name: Upload Artifact uses: actions/upload-artifact@v3 diff --git a/FAFB-PowerShell-Tool.Tests/FAFB-PowerShell-Tool.Tests.csproj b/FAFB-PowerShell-Tool.Tests/FAFB-PowerShell-Tool.Tests.csproj new file mode 100644 index 0000000..a3d96d5 --- /dev/null +++ b/FAFB-PowerShell-Tool.Tests/FAFB-PowerShell-Tool.Tests.csproj @@ -0,0 +1,24 @@ + + + + net8.0-windows + FAFB_PowerShell_Tool.Tests + enable + enable + + false + true + + + + + + + + + + + + + + diff --git a/FAFB-PowerShell-Tool.Tests/GlobalUsings.cs b/FAFB-PowerShell-Tool.Tests/GlobalUsings.cs new file mode 100644 index 0000000..ab67c7e --- /dev/null +++ b/FAFB-PowerShell-Tool.Tests/GlobalUsings.cs @@ -0,0 +1 @@ +global using Microsoft.VisualStudio.TestTools.UnitTesting; \ No newline at end of file diff --git a/FAFB-PowerShell-Tool.Tests/PowerShellExecutorTest.cs b/FAFB-PowerShell-Tool.Tests/PowerShellExecutorTest.cs new file mode 100644 index 0000000..28deeea --- /dev/null +++ b/FAFB-PowerShell-Tool.Tests/PowerShellExecutorTest.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FAFB_PowerShell_Tool.Tests +{ + [TestClass] + public class PowerShellExecutorTest + { + [TestMethod] + public void ThrowArgumentNullExceptionWhenCommandTextIsNull() + { + Assert.ThrowsException(() => PowerShellExecutor.Execute(null!)); + } + + [TestMethod] + public void ThrowArgumentExceptionWhenCommandTextIsWhitespace() + { + Assert.ThrowsException(() => PowerShellExecutor.Execute("")); + Assert.ThrowsException(() => PowerShellExecutor.Execute(" ")); + } + } +} diff --git a/FAFB-PowerShell-Tool.sln b/FAFB-PowerShell-Tool.sln index e992312..411f4fa 100644 --- a/FAFB-PowerShell-Tool.sln +++ b/FAFB-PowerShell-Tool.sln @@ -1,10 +1,11 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34309.116 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FAFB-PowerShell-Tool", "FAFB-PowerShell-Tool\FAFB-PowerShell-Tool.csproj", "{C6E51308-E9E0-4738-9D5A-49841912633B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FAFB-PowerShell-Tool.Tests", "FAFB-PowerShell-Tool.Tests\FAFB-PowerShell-Tool.Tests.csproj", "{E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +40,26 @@ Global {C6E51308-E9E0-4738-9D5A-49841912633B}.Release|x64.Build.0 = Release|Any CPU {C6E51308-E9E0-4738-9D5A-49841912633B}.Release|x86.ActiveCfg = Release|Any CPU {C6E51308-E9E0-4738-9D5A-49841912633B}.Release|x86.Build.0 = Release|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Debug|ARM.ActiveCfg = Debug|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Debug|ARM.Build.0 = Debug|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Debug|ARM64.Build.0 = Debug|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Debug|x64.ActiveCfg = Debug|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Debug|x64.Build.0 = Debug|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Debug|x86.ActiveCfg = Debug|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Debug|x86.Build.0 = Debug|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Release|Any CPU.Build.0 = Release|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Release|ARM.ActiveCfg = Release|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Release|ARM.Build.0 = Release|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Release|ARM64.ActiveCfg = Release|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Release|ARM64.Build.0 = Release|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Release|x64.ActiveCfg = Release|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Release|x64.Build.0 = Release|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Release|x86.ActiveCfg = Release|Any CPU + {E93739C2-C7BC-4F69-BEA2-C5F30548EA8C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/FAFB-PowerShell-Tool/FAFB-PowerShell-Tool.csproj b/FAFB-PowerShell-Tool/FAFB-PowerShell-Tool.csproj index 6c111f7..566eb29 100644 --- a/FAFB-PowerShell-Tool/FAFB-PowerShell-Tool.csproj +++ b/FAFB-PowerShell-Tool/FAFB-PowerShell-Tool.csproj @@ -8,10 +8,17 @@ enable true - true + + false true embedded - true + true - \ No newline at end of file + + + + + + + diff --git a/FAFB-PowerShell-Tool/MainWindow.xaml b/FAFB-PowerShell-Tool/MainWindow.xaml index c20cd99..2c23aa0 100644 --- a/FAFB-PowerShell-Tool/MainWindow.xaml +++ b/FAFB-PowerShell-Tool/MainWindow.xaml @@ -5,8 +5,16 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:FAFB_PowerShell_Tool" mc:Ignorable="d" - Title="MainWindow" Height="450" Width="800"> + Title="Active Directory Queries" Height="450" Width="800"> + +