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

Commit

Permalink
New test
Browse files Browse the repository at this point in the history
  • Loading branch information
StrangeRanger committed Mar 27, 2024
1 parent 3390070 commit eede5e2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
27 changes: 27 additions & 0 deletions ActiveDirectoryQuerier.Tests/MainWindowViewModelTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Windows;
using ActiveDirectoryQuerier.MessageBoxService;
using Moq;

namespace ActiveDirectoryQuerier.Tests;

public class MainWindowViewModelTests
{
[Fact]
public void EditQueryFromQueryStackPanel_NullParameter_ShowsMessageBox()
{
// Arrange
var mockMessageBoxService = new Mock<IMessageBoxService>();
var viewModel = new MainWindowViewModel
{
MessageBoxService = mockMessageBoxService.Object
};

// Act
viewModel.EditQueryFromQueryStackPanel(null);

// Assert
mockMessageBoxService.Verify(
x => x.Show(It.IsAny<string>(), "Error", MessageBoxButton.OK, MessageBoxImage.Error),
Times.Once);
}
}

0 comments on commit eede5e2

Please sign in to comment.