Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Format with clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
StrangeRanger committed Mar 14, 2024
1 parent 6f9bec4 commit 4c01310
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 34 deletions.
16 changes: 12 additions & 4 deletions ActiveDirectoryQuerier.Tests/PSExecutorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ public class PSExecutorTests
[Theory]
[InlineData("Get-Command", "Module", "ActiveDirectory")]
[InlineData("Get-Process", "Name", "explorer")]
public void Execute_WhenGivenValidCommand_ReturnsExpectedOutput(string command, string parameter, string parameterValue)
public void Execute_WhenGivenValidCommand_ReturnsExpectedOutput(string command,
string parameter,
string parameterValue)
{
// Arrange
Command psCommand = new(command);
Expand Down Expand Up @@ -46,7 +48,9 @@ public void Execute_CheckIfOutputChanged_ReturnsDifferentOutput()
[Theory]
[InlineData("Get-Command", "Module", "ActiveDirectory")]
[InlineData("Get-Process", "Name", "explorer")]
public async Task ExecuteAsync_WhenGivenValidCommand_ReturnsExpectedOutput(string command, string parameter, string parameterValue)
public async Task ExecuteAsync_WhenGivenValidCommand_ReturnsExpectedOutput(string command,
string parameter,
string parameterValue)
{
// Arrange
Command psCommand = new(command);
Expand All @@ -65,7 +69,9 @@ public async Task ExecuteAsync_WhenGivenValidCommand_ReturnsExpectedOutput(strin
[Theory]
[InlineData("Get-ADUser", "InvalidParameter", "*")]
[InlineData("InvalidCommand", "Filter", "*")]
public void Execute_WhenGivenInvalidCommand_ReturnsExpectedOutput(string command, string parameter, string parameterValue)
public void Execute_WhenGivenInvalidCommand_ReturnsExpectedOutput(string command,
string parameter,
string parameterValue)
{
// Arrange
Command psCommand = new(command);
Expand All @@ -84,7 +90,9 @@ public void Execute_WhenGivenInvalidCommand_ReturnsExpectedOutput(string command
[Theory]
[InlineData("Get-ADUser", "InvalidParameter", "*")]
[InlineData("InvalidCommand", "Filter", "*")]
public async Task ExecuteAsync_WhenGivenInvalidCommand_ReturnsExpectedOutput(string command, string parameter, string parameterValue)
public async Task ExecuteAsync_WhenGivenInvalidCommand_ReturnsExpectedOutput(string command,
string parameter,
string parameterValue)
{
// Arrange
Command psCommand = new(command);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ActiveDirectoryQuerier.ActiveDirectory;
public class ADCommandParameters
{
private readonly ObservableCollection<string> _availableParameters = new();

/// <summary></summary>
/// <important>
/// This property should not be accessed before LoadAvailableParametersAsync or LoadAvailableParameters has been
Expand Down
42 changes: 16 additions & 26 deletions ActiveDirectoryQuerier/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,26 +109,22 @@ public Command? SelectedCommandFromComboBoxInQueryBuilder
}
}
}

public Command? SelectedCommandFromComboBoxInActiveDirectoryInfo
{
get => _selectedCommandFromComboBoxInActiveDirectoryInfo;
set
{
set {
if (_selectedCommandFromComboBoxInActiveDirectoryInfo != value)
{
_selectedCommandFromComboBoxInActiveDirectoryInfo = value;
OnPropertyChanged(nameof(SelectedCommandFromComboBoxInActiveDirectoryInfo));
}
}
}

public List<string> AvailableOptionsFromComboBoxInActiveDirectoryInfo { get; } = new()
{
"Get user on domain",
"Get computers on domain",
"Get IP of each system on domain"
};

public List<string> AvailableOptionsFromComboBoxInActiveDirectoryInfo {
get;
} = new() { "Get user on domain", "Get computers on domain", "Get IP of each system on domain" };

public ObservableCollection<Button> QueryButtonStackPanel => _buttons ??= new ObservableCollection<Button>();

Expand Down Expand Up @@ -165,9 +161,7 @@ public Command? SelectedCommandFromComboBoxInActiveDirectoryInfo
public ICommand ClearConsoleOutputInQueryBuilderRelay { get; }
public ICommand ImportQueryFileRelay { get; }
public ICommand CreateNewQueryFileRelay { get; }
public ICommand ClearConsoleOutputInActiveDirectoryInfoRelay {
get;
} // TODO: Impliment functionality.....
public ICommand ClearConsoleOutputInActiveDirectoryInfoRelay { get; } // TODO: Impliment functionality.....

/* TODO: for Pieter
*
Expand All @@ -177,10 +171,9 @@ public ICommand ClearConsoleOutputInActiveDirectoryInfoRelay {
*
* Create a property to act as the relay to the execution button.
*/


//NEW CODE
// [ Constructor ] ------------------------------------------------------------- //

// NEW CODE
// [ Constructor ] ------------------------------------------------------------- //

public MainWindowViewModel()
{
Expand Down Expand Up @@ -337,10 +330,10 @@ private void DeleteQueryFromQueryStackPanel(object queryButton)
}

MessageBoxResult result = MessageBox.Show("Are you sure you want to delete the query?",
"Warning",
MessageBoxButton.YesNo,
MessageBoxImage.Warning,
MessageBoxResult.No);
"Warning",
MessageBoxButton.YesNo,
MessageBoxImage.Warning,
MessageBoxResult.No);

if (result == MessageBoxResult.Yes)
{
Expand Down Expand Up @@ -385,11 +378,8 @@ private void LoadSavedQueriesFromFile()

private void ImportQueryFile(object _)
{
OpenFileDialog dialog = new() {
FileName = "CustomQueries.dat",
Filter = "Json files (*.json)|*.json|Text Files (*.txt)|*.txt"
};

OpenFileDialog dialog =
new() { FileName = "CustomQueries.dat", Filter = "Json files (*.json)|*.json|Text Files (*.txt)|*.txt" };

// Display
bool? result = dialog.ShowDialog();
Expand Down
2 changes: 1 addition & 1 deletion ActiveDirectoryQuerier/PowerShell/PSExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public PSExecutor()
_powerShell.Invoke();
_powerShell.Commands.Clear();
}

private void AssembleFullCommand(Command psCommand)
{
ArgumentNullException.ThrowIfNull(psCommand);
Expand Down
3 changes: 1 addition & 2 deletions ActiveDirectoryQuerier/Queries/CustomQueries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void SaveQueriesToJson()
{
string serializedJsonQueries = JsonSerializer.Serialize(Queries, _options);
File.WriteAllText(CustomQueryFileLocation == "" ? "CustomQueries.json" : CustomQueryFileLocation,
serializedJsonQueries);
serializedJsonQueries);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -75,7 +75,6 @@ public void SerializeCommand(Command? psCommand, string queryName, string queryD
if (CustomQueryFileLocation == "")
{
File.WriteAllText("CustomQueries.json", serializedJsonQueries);

}
else
{
Expand Down

0 comments on commit 4c01310

Please sign in to comment.