1c546c111a
- Fix CriteriaSheetGenerator.FormatTimestamp to handle all DateTimeKind values - Update TestWebApplicationFactory to use IAuthenticationService - Add logger parameter to ExcelParserServiceTests - Add SecureStoreManager to solution under /utils/ folder
94 lines
2.5 KiB
C#
94 lines
2.5 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Headless.XUnit;
|
|
using Avalonia.VisualTree;
|
|
using Shouldly;
|
|
using Xunit;
|
|
using JdeScoping.SecureStoreManager.ViewModels;
|
|
using JdeScoping.SecureStoreManager.Views;
|
|
|
|
namespace JdeScoping.SecureStoreManager.Tests.Views;
|
|
|
|
public class NewStoreDialogTests
|
|
{
|
|
[AvaloniaFact]
|
|
public void NewStoreDialog_ShowsWithCorrectTitle()
|
|
{
|
|
// Arrange & Act
|
|
var dialog = new NewStoreDialog();
|
|
dialog.Show();
|
|
|
|
// Assert
|
|
dialog.Title.ShouldBe("Create New Store");
|
|
}
|
|
|
|
[AvaloniaFact]
|
|
public void NewStoreDialog_DataContextIsNewStoreDialogViewModel()
|
|
{
|
|
// Arrange & Act
|
|
var dialog = new NewStoreDialog();
|
|
dialog.Show();
|
|
|
|
// Assert
|
|
dialog.DataContext.ShouldBeOfType<NewStoreDialogViewModel>();
|
|
}
|
|
|
|
[AvaloniaFact]
|
|
public void NewStoreDialog_HasStorePathTextBox()
|
|
{
|
|
// Arrange & Act
|
|
var dialog = new NewStoreDialog();
|
|
dialog.Show();
|
|
|
|
// Assert
|
|
var textBoxes = dialog.GetVisualDescendants().OfType<TextBox>().ToList();
|
|
textBoxes.Count.ShouldBeGreaterThan(0);
|
|
}
|
|
|
|
[AvaloniaFact]
|
|
public void NewStoreDialog_HasRadioButtons()
|
|
{
|
|
// Arrange & Act
|
|
var dialog = new NewStoreDialog();
|
|
dialog.Show();
|
|
|
|
// Assert
|
|
var radioButtons = dialog.GetVisualDescendants().OfType<RadioButton>().ToList();
|
|
radioButtons.Count.ShouldBeGreaterThanOrEqualTo(2);
|
|
}
|
|
|
|
[AvaloniaFact]
|
|
public void NewStoreDialog_HasCreateAndCancelButtons()
|
|
{
|
|
// Arrange & Act
|
|
var dialog = new NewStoreDialog();
|
|
dialog.Show();
|
|
|
|
// Assert
|
|
var buttons = dialog.GetVisualDescendants().OfType<Button>().ToList();
|
|
buttons.Any(b => b.Content?.ToString() == "Create").ShouldBeTrue();
|
|
buttons.Any(b => b.Content?.ToString() == "Cancel").ShouldBeTrue();
|
|
}
|
|
|
|
[AvaloniaFact]
|
|
public void NewStoreDialog_ViewModelProperty_ReturnsDataContext()
|
|
{
|
|
// Arrange & Act
|
|
var dialog = new NewStoreDialog();
|
|
dialog.Show();
|
|
|
|
// Assert
|
|
dialog.ViewModel.ShouldBe(dialog.DataContext);
|
|
}
|
|
|
|
[AvaloniaFact]
|
|
public void NewStoreDialog_CannotResize()
|
|
{
|
|
// Arrange & Act
|
|
var dialog = new NewStoreDialog();
|
|
dialog.Show();
|
|
|
|
// Assert
|
|
dialog.CanResize.ShouldBeFalse();
|
|
}
|
|
}
|