added tests to project

This commit is contained in:
2026-08-09 18:31:43 +05:00
parent 6da32504f9
commit d5dc228ebe
39 changed files with 6491 additions and 0 deletions
@@ -0,0 +1,48 @@
using CursorLang.Models;
using CursorLang.ViewModels;
namespace CursorLang.Tests.ViewModels;
public sealed class LayoutPopupViewModelTests
{
// Before the first layout change there is nothing to show, yet the window
// is already being built
[Fact]
public void Before_the_first_layout_a_dash_is_shown()
{
Assert.Equal("—", new LayoutPopupViewModel(new AppSettings()).ShortName);
}
[Fact]
public void The_look_comes_straight_from_the_settings()
{
var settings = new AppSettings();
Assert.Same(settings, new LayoutPopupViewModel(settings).Settings);
}
[Fact]
public void A_changed_layout_name_is_announced_to_subscribers()
{
var viewModel = new LayoutPopupViewModel(new AppSettings());
List<string?> changed = [];
viewModel.PropertyChanged += (_, e) => changed.Add(e.PropertyName);
viewModel.ShortName = "RU";
Assert.Equal("RU", viewModel.ShortName);
Assert.Equal([nameof(LayoutPopupViewModel.ShortName)], changed);
}
[Fact]
public void The_same_layout_name_is_not_announced_again()
{
var viewModel = new LayoutPopupViewModel(new AppSettings()) { ShortName = "RU" };
List<string?> changed = [];
viewModel.PropertyChanged += (_, e) => changed.Add(e.PropertyName);
viewModel.ShortName = "RU";
Assert.Empty(changed);
}
}