diff --git a/.github/ISSUE_TEMPLATE/frontend-requirement-specification.md b/.github/ISSUE_TEMPLATE/frontend-requirement-specification.md
index 510f2c6..2ba040c 100644
--- a/.github/ISSUE_TEMPLATE/frontend-requirement-specification.md
+++ b/.github/ISSUE_TEMPLATE/frontend-requirement-specification.md
@@ -1,7 +1,7 @@
---
name: Frontend Requirement Specification
about: For specifying the frontend requirements of the project.
-title: Frontend – [Requirement Description]
+title: Frontend – [Requirement Description] – [Gui Element]
labels: requirement
assignees: ''
diff --git a/.github/workflows/build-test-ci.yml b/.github/workflows/build-test-ci.yml
index 4e6968f..797c608 100644
--- a/.github/workflows/build-test-ci.yml
+++ b/.github/workflows/build-test-ci.yml
@@ -9,12 +9,11 @@ jobs:
strategy:
matrix:
targetplatform: [x64]
- #targetplatform: [x86, x64]
runs-on: windows-latest
env:
- Project_File: FAFB-PowerShell-Tool\FAFB-PowerShell-Tool.csproj
+ Project_File: ActiveDirectoryQuerier\ActiveDirectoryQuerier.csproj
steps:
- name: Checkout
@@ -31,7 +30,8 @@ jobs:
Import-Module ActiveDirectory
- name: Dotnet Restore & Build
- run: dotnet build $env:Project_File -c Debug -f net6.0-windows -r win-${{ matrix.targetplatform }}
+ run: dotnet build $env:Project_File -c Debug -f net8.0-windows -r win-${{ matrix.targetplatform }}
- - name: Dotnet Test
- run: dotnet test
+ - name: Dotnet Test with Coverage
+ run: |
+ dotnet test $env:Project_File --no-build
diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml
index cb29c6c..c394044 100644
--- a/.github/workflows/release-ci.yml
+++ b/.github/workflows/release-ci.yml
@@ -16,7 +16,7 @@ jobs:
runs-on: windows-latest
env:
- Project_File: FAFB-PowerShell-Tool\FAFB-PowerShell-Tool.csproj
+ Project_File: ActiveDirectoryQuerier\ActiveDirectoryQuerier.csproj
steps:
- name: Checkout
@@ -30,15 +30,15 @@ jobs:
- name: Dotnet Build & Publish
run: |
dotnet build $env:Project_File -c Release -f net6.0-windows -r win-${{ matrix.targetplatform }}
- dotnet publish $env:Project_File -c Release -f net6.0-windows -r win-${{ matrix.targetplatform }} -o ./publish/FAFB_PowerShell_Tool_${{ matrix.targetplatform }}
+ dotnet publish $env:Project_File -c Release -f net6.0-windows -r win-${{ matrix.targetplatform }} -o ./publish/ActiveDirectoryQuerier_${{ matrix.targetplatform }}
- name: Zip Release Files
- run: Compress-Archive -Path .\publish\FAFB_PowerShell_Tool_${{ matrix.targetplatform }} -DestinationPath .\FAFB_PowerShell_Tool_${{ matrix.targetplatform }}.zip
+ run: Compress-Archive -Path .\publish\ActiveDirectoryQuerier_${{ matrix.targetplatform }} -DestinationPath .\ActiveDirectoryQuerier_${{ matrix.targetplatform }}.zip
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
- files: FAFB_PowerShell_Tool_${{ matrix.targetplatform }}.zip
+ files: ActiveDirectoryQuerier_${{ matrix.targetplatform }}.zip
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
diff --git a/.gitignore b/.gitignore
index e0bed98..248bc4c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -476,14 +476,14 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk
-.vscode/launch.json
-
-.vscode/tasks.json
+# Rider files
+.idea
-.idea/.idea.FAFB-PowerShell-Tool/.idea/indexLayout.xml
-.idea/.idea.FAFB-PowerShell-Tool/.idea/workspace.xml
-
-FAFB-PowerShell-Tool/FAFB-PowerShell-Tool-Output.txt
+# VSCode files
+.vscode/launch.json
+.vscode/tasks.json
-.idea/.idea.FAFB-PowerShell-Tool/.idea/
+# Text and CSV files
+*.txt
+*.csv
diff --git a/FAFB-PowerShell-Tool.Tests/ActiveDirectoryCommandsTests.cs b/ActiveDirectoryQuerier.Tests/ActiveDirectoryCommandsTests.cs
similarity index 88%
rename from FAFB-PowerShell-Tool.Tests/ActiveDirectoryCommandsTests.cs
rename to ActiveDirectoryQuerier.Tests/ActiveDirectoryCommandsTests.cs
index b622785..267c130 100644
--- a/FAFB-PowerShell-Tool.Tests/ActiveDirectoryCommandsTests.cs
+++ b/ActiveDirectoryQuerier.Tests/ActiveDirectoryCommandsTests.cs
@@ -1,9 +1,8 @@
using System.Collections.ObjectModel;
-using System.Management.Automation;
using System.Management.Automation.Runspaces;
-using FAFB_PowerShell_Tool.PowerShell;
+using ActiveDirectoryQuerier.PowerShell;
-namespace FAFB_PowerShell_Tool.Tests;
+namespace ActiveDirectoryQuerier.Tests;
public class ActiveDirectoryCommandsTests
{
diff --git a/FAFB-PowerShell-Tool.Tests/FAFB-PowerShell-Tool.Tests.csproj b/ActiveDirectoryQuerier.Tests/ActiveDirectoryQuerier.Tests.csproj
similarity index 62%
rename from FAFB-PowerShell-Tool.Tests/FAFB-PowerShell-Tool.Tests.csproj
rename to ActiveDirectoryQuerier.Tests/ActiveDirectoryQuerier.Tests.csproj
index 557a86e..ee0dbed 100644
--- a/FAFB-PowerShell-Tool.Tests/FAFB-PowerShell-Tool.Tests.csproj
+++ b/ActiveDirectoryQuerier.Tests/ActiveDirectoryQuerier.Tests.csproj
@@ -1,29 +1,25 @@
- net6.0-windows
- FAFB_PowerShell_Tool.Tests
- enable
- enable
- true
-
false
+ ActiveDirectoryQuerier.Tests
+ ActiveDirectoryQuerier.Tests
-
-
-
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
diff --git a/FAFB-PowerShell-Tool.Tests/CommandParametersTests.cs b/ActiveDirectoryQuerier.Tests/CommandParametersTests.cs
similarity index 93%
rename from FAFB-PowerShell-Tool.Tests/CommandParametersTests.cs
rename to ActiveDirectoryQuerier.Tests/CommandParametersTests.cs
index 00b6c73..aa749a2 100644
--- a/FAFB-PowerShell-Tool.Tests/CommandParametersTests.cs
+++ b/ActiveDirectoryQuerier.Tests/CommandParametersTests.cs
@@ -1,7 +1,7 @@
using System.Management.Automation.Runspaces;
-using FAFB_PowerShell_Tool.PowerShell;
+using ActiveDirectoryQuerier.PowerShell;
-namespace FAFB_PowerShell_Tool.Tests;
+namespace ActiveDirectoryQuerier.Tests;
public class CommandParametersTests
{
@@ -28,7 +28,7 @@ public async Task LoadCommandParametersAsync_PopulatesPossibleParameters_IsNotEm
// Assert
Assert.NotEmpty(commandParameters.PossibleParameters);
}
-
+
[Fact]
public async Task LoadCommandParametersAsync_CheckPossibleParameter_ContentIsCorrect()
{
diff --git a/FAFB-PowerShell-Tool.Tests/GlobalUsings.cs b/ActiveDirectoryQuerier.Tests/GlobalUsings.cs
similarity index 100%
rename from FAFB-PowerShell-Tool.Tests/GlobalUsings.cs
rename to ActiveDirectoryQuerier.Tests/GlobalUsings.cs
diff --git a/FAFB-PowerShell-Tool.Tests/PowerShellExecutorTests.cs b/ActiveDirectoryQuerier.Tests/PowerShellExecutorTests.cs
similarity index 94%
rename from FAFB-PowerShell-Tool.Tests/PowerShellExecutorTests.cs
rename to ActiveDirectoryQuerier.Tests/PowerShellExecutorTests.cs
index b62f992..24c8828 100644
--- a/FAFB-PowerShell-Tool.Tests/PowerShellExecutorTests.cs
+++ b/ActiveDirectoryQuerier.Tests/PowerShellExecutorTests.cs
@@ -1,7 +1,7 @@
using System.Management.Automation.Runspaces;
-using FAFB_PowerShell_Tool.PowerShell;
+using ActiveDirectoryQuerier.PowerShell;
-namespace FAFB_PowerShell_Tool.Tests;
+namespace ActiveDirectoryQuerier.Tests;
public class PowerShellExecutorTests
{
@@ -23,7 +23,7 @@ public void Execute_WhenGivenValidCommand_ReturnsExpectedOutput(string cmd, stri
Assert.Empty(result.StdErr);
Assert.NotEmpty(result.StdOut);
}
-
+
[Fact]
public void Execute_CheckIfOutputChanged_ReturnsDifferentOutput()
{
@@ -45,7 +45,7 @@ public void Execute_CheckIfOutputChanged_ReturnsDifferentOutput()
[Theory]
[InlineData("Get-Command", "Module", "ActiveDirectory")]
[InlineData("Get-Process", "Name", "explorer")]
- public async void ExecuteAsync_WhenGivenValidCommand_ReturnsExpectedOutput(string cmd,
+ public async Task ExecuteAsync_WhenGivenValidCommand_ReturnsExpectedOutput(string cmd,
string paramName,
string paramValue)
{
@@ -85,7 +85,7 @@ public void Execute_WhenGivenInvalidCommand_ReturnsExpectedOutput(string cmd, st
[Theory]
[InlineData("Get-ADUser", "InvalidParameter", "*")]
[InlineData("InvalidCommand", "Filter", "*")]
- public async void ExecuteAsync_WhenGivenInvalidCommand_ReturnsExpectedOutput(string cmd,
+ public async Task ExecuteAsync_WhenGivenInvalidCommand_ReturnsExpectedOutput(string cmd,
string paramName,
string paramValue)
{
diff --git a/FAFB-PowerShell-Tool.Tests/RelayCommandTests.cs b/ActiveDirectoryQuerier.Tests/RelayCommandTests.cs
similarity index 93%
rename from FAFB-PowerShell-Tool.Tests/RelayCommandTests.cs
rename to ActiveDirectoryQuerier.Tests/RelayCommandTests.cs
index 2d8d060..b44ba75 100644
--- a/FAFB-PowerShell-Tool.Tests/RelayCommandTests.cs
+++ b/ActiveDirectoryQuerier.Tests/RelayCommandTests.cs
@@ -1,4 +1,4 @@
-namespace FAFB_PowerShell_Tool.Tests;
+namespace ActiveDirectoryQuerier.Tests;
public class RelayCommandTests
{
@@ -76,6 +76,7 @@ public void CanExecuteChanged_WithNullParameter_DoesNotThrow2()
RelayCommand command = new(
_ =>
{});
+ // ReSharper disable once EventUnsubscriptionViaAnonymousDelegate
command.CanExecuteChanged -= (_, _) =>
{};
}
diff --git a/FAFB-PowerShell-Tool.Tests/ReturnValuesTest.cs b/ActiveDirectoryQuerier.Tests/ReturnValuesTest.cs
similarity index 90%
rename from FAFB-PowerShell-Tool.Tests/ReturnValuesTest.cs
rename to ActiveDirectoryQuerier.Tests/ReturnValuesTest.cs
index fac5a3d..7e75175 100644
--- a/FAFB-PowerShell-Tool.Tests/ReturnValuesTest.cs
+++ b/ActiveDirectoryQuerier.Tests/ReturnValuesTest.cs
@@ -1,6 +1,6 @@
-using FAFB_PowerShell_Tool.PowerShell;
+using ActiveDirectoryQuerier.PowerShell;
-namespace FAFB_PowerShell_Tool.Tests;
+namespace ActiveDirectoryQuerier.Tests;
public class ReturnValuesTest
{
diff --git a/FAFB-PowerShell-Tool.sln b/ActiveDirectoryQuerier.sln
similarity index 91%
rename from FAFB-PowerShell-Tool.sln
rename to ActiveDirectoryQuerier.sln
index 1cbddd3..953b81b 100644
--- a/FAFB-PowerShell-Tool.sln
+++ b/ActiveDirectoryQuerier.sln
@@ -2,9 +2,9 @@ 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}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ActiveDirectoryQuerier", "ActiveDirectoryQuerier\ActiveDirectoryQuerier.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", "{C1FD9137-6780-44AE-9920-A566FC555F68}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActiveDirectoryQuerier.Tests", "ActiveDirectoryQuerier.Tests\ActiveDirectoryQuerier.Tests.csproj", "{C1FD9137-6780-44AE-9920-A566FC555F68}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/ActiveDirectoryQuerier/ActiveDirectoryQuerier.csproj b/ActiveDirectoryQuerier/ActiveDirectoryQuerier.csproj
new file mode 100644
index 0000000..29697df
--- /dev/null
+++ b/ActiveDirectoryQuerier/ActiveDirectoryQuerier.csproj
@@ -0,0 +1,28 @@
+
+
+
+ WinExe
+ x64
+ true
+ ActiveDirectoryQuerier
+ ActiveDirectoryQuerier
+
+
+ Active Directory Querier
+ 0.4.1
+ Hunter T., Pieter Landry Sobtafo, Joseph
+ https://github.com/StrangeRanger/FAFB-PowerShell-Tool
+
+
+ false
+ true
+ embedded
+ true
+
+
+
+
+
+
+
+
diff --git a/FAFB-PowerShell-Tool/App.xaml b/ActiveDirectoryQuerier/App.xaml
similarity index 70%
rename from FAFB-PowerShell-Tool/App.xaml
rename to ActiveDirectoryQuerier/App.xaml
index 251099b..4a1f861 100644
--- a/FAFB-PowerShell-Tool/App.xaml
+++ b/ActiveDirectoryQuerier/App.xaml
@@ -1,7 +1,6 @@
-
diff --git a/FAFB-PowerShell-Tool/App.xaml.cs b/ActiveDirectoryQuerier/App.xaml.cs
similarity index 79%
rename from FAFB-PowerShell-Tool/App.xaml.cs
rename to ActiveDirectoryQuerier/App.xaml.cs
index b06bd4e..8f83fe4 100644
--- a/FAFB-PowerShell-Tool/App.xaml.cs
+++ b/ActiveDirectoryQuerier/App.xaml.cs
@@ -1,6 +1,6 @@
using System.Windows;
-namespace FAFB_PowerShell_Tool;
+namespace ActiveDirectoryQuerier;
///
/// Interaction logic for App.xaml
diff --git a/FAFB-PowerShell-Tool/AssemblyInfo.cs b/ActiveDirectoryQuerier/AssemblyInfo.cs
similarity index 100%
rename from FAFB-PowerShell-Tool/AssemblyInfo.cs
rename to ActiveDirectoryQuerier/AssemblyInfo.cs
diff --git a/FAFB-PowerShell-Tool/ComboBoxParameterViewModel.cs b/ActiveDirectoryQuerier/ComboBoxParameterViewModel.cs
similarity index 75%
rename from FAFB-PowerShell-Tool/ComboBoxParameterViewModel.cs
rename to ActiveDirectoryQuerier/ComboBoxParameterViewModel.cs
index e174408..b9c800e 100644
--- a/FAFB-PowerShell-Tool/ComboBoxParameterViewModel.cs
+++ b/ActiveDirectoryQuerier/ComboBoxParameterViewModel.cs
@@ -1,7 +1,7 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
-namespace FAFB_PowerShell_Tool;
+namespace ActiveDirectoryQuerier;
///
/// ViewModel for a ComboBox that displays possible parameters for a PowerShell command.
@@ -12,13 +12,6 @@ public sealed class ComboBoxParameterViewModel : INotifyPropertyChanged
public event PropertyChangedEventHandler? PropertyChanged;
private ObservableCollection _possibleParameterList = new();
private string _selectedParameter = string.Empty;
- private string _selectedParameterValue = string.Empty;
-
- ///
- /// Empty constructor to initialize a new ComboBoxParameterViewModel.
- ///
- public ComboBoxParameterViewModel()
- { }
///
/// Initializes a new instance of the ComboBoxParameterViewModel class.
@@ -30,7 +23,7 @@ public ComboBoxParameterViewModel(ObservableCollection possibleParameter
}
///
- /// Sets a unique selected value for each combo box
+ /// Sets a unique selected value for each combo box.
///
public string SelectedParameter
{
@@ -44,21 +37,6 @@ public string SelectedParameter
}
}
- ///
- /// Gets or sets the selected parameter value for the unique ComboBox.
- ///
- public string SelectedParameterValue
- {
- get => _selectedParameterValue;
- set {
- if (_selectedParameterValue != value)
- {
- _selectedParameterValue = value;
- OnPropertyChanged(nameof(SelectedParameterValue));
- }
- }
- }
-
///
/// Gets or sets the list of possible parameters that can be selected for a command.
///
diff --git a/FAFB-PowerShell-Tool/MainWindow.xaml b/ActiveDirectoryQuerier/MainWindow.xaml
similarity index 81%
rename from FAFB-PowerShell-Tool/MainWindow.xaml
rename to ActiveDirectoryQuerier/MainWindow.xaml
index 41145df..056efe5 100644
--- a/FAFB-PowerShell-Tool/MainWindow.xaml
+++ b/ActiveDirectoryQuerier/MainWindow.xaml
@@ -1,13 +1,13 @@
-
-
+
@@ -36,28 +36,30 @@
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -102,9 +104,8 @@
-
-
@@ -130,20 +130,10 @@
-
-
-
+
@@ -203,30 +192,30 @@
-
+public sealed class MainWindowViewModel : INotifyPropertyChanged
+{
+ // [ Fields ]-------------------------------------------------------------------- //
+ // [[ Event handler property ]] ------------------------------------------------- //
+
+ public event PropertyChangedEventHandler? PropertyChanged;
+
+ // [[ Backing fields for properties ]] ------------------------------------------ //
+
+ private string _powerShellOutput;
+ private string _queryName;
+ private string _queryDescription;
+ private Command? _selectedComboBoxCommand;
+ private ObservableCollection
/// The command to be executed.
/// A task containing a ReturnValues object with the results of the command execution.
- public async Task ExecuteAsync(Command command)
+ public async Task ExecuteAsync(Command? command)
{
try
{
PrepareCommand(command);
PSDataCollection results = await _powerShell.InvokeAsync();
+
return await ProcessPowerShellResultsAsync(results);
}
catch (Exception ex)
{
- StringBuilder sb = new();
- sb.AppendLine("An error occurred while executing the PowerShell command:");
- sb.AppendLine(ex.Message);
- sb.AppendLine(ex.StackTrace);
- Debug.WriteLine(sb.ToString());
- return new ReturnValues { StdErr = { sb.ToString() } };
+ return ExecutionExceptionHandler(ex);
}
}
+ ///
+ /// Handles exceptions that occur during the execution of a PowerShell command.
+ ///
+ /// The exception that occurred during the execution of the PowerShell command.
+ /// A ReturnValues object containing the exception details.
+ private ReturnValues ExecutionExceptionHandler(Exception ex)
+ {
+ StringBuilder sb = new();
+
+ sb.AppendLine("An error occurred while executing the PowerShell command:");
+ sb.AppendLine(ex.Message);
+ sb.AppendLine(ex.StackTrace);
+ Debug.WriteLine(sb.ToString());
+
+ return new ReturnValues { StdErr = { sb.ToString() } };
+ }
+
///
/// Processes and formats the results of a PowerShell command execution synchronously.
///
diff --git a/FAFB-PowerShell-Tool/PowerShell/ReturnValues.cs b/ActiveDirectoryQuerier/PowerShell/ReturnValues.cs
similarity index 95%
rename from FAFB-PowerShell-Tool/PowerShell/ReturnValues.cs
rename to ActiveDirectoryQuerier/PowerShell/ReturnValues.cs
index 2141750..afcad90 100644
--- a/FAFB-PowerShell-Tool/PowerShell/ReturnValues.cs
+++ b/ActiveDirectoryQuerier/PowerShell/ReturnValues.cs
@@ -1,4 +1,4 @@
-namespace FAFB_PowerShell_Tool.PowerShell;
+namespace ActiveDirectoryQuerier.PowerShell;
///
/// Encapsulates the return values from a PowerShell command, separated into standard output (StdOut) and standard
diff --git a/FAFB-PowerShell-Tool/RelayCommand.cs b/ActiveDirectoryQuerier/RelayCommand.cs
similarity index 79%
rename from FAFB-PowerShell-Tool/RelayCommand.cs
rename to ActiveDirectoryQuerier/RelayCommand.cs
index 231b3c5..29ddc36 100644
--- a/FAFB-PowerShell-Tool/RelayCommand.cs
+++ b/ActiveDirectoryQuerier/RelayCommand.cs
@@ -1,13 +1,17 @@
using System.Windows.Input;
-namespace FAFB_PowerShell_Tool;
+namespace ActiveDirectoryQuerier;
///
/// A command whose sole purpose is to relay its functionality to other objects by invoking delegates.
+/// TODO: Remove any unused methods, after some investigation.
///
+///
+/// I'm unsure if I'm dealing with the nullability warnings correctly, in this situation...
+///
public class RelayCommand : ICommand
{
- private readonly Action