Files
cursor-lang/CursorLang.Tests/ViewModels/LayoutPopupViewModelTests.cs
T
2026-08-09 18:31:43 +05:00

49 lines
1.4 KiB
C#

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);
}
}