using Marathon.UI.Services; namespace Marathon.UI.Tests.Services; public sealed class EventBrowsingStateTests { [Fact] public void Default_filter_spans_minus_one_to_plus_seven_days() { var state = new EventBrowsingState(); var f = state.PreMatch; (f.To - f.From).TotalDays.Should().BeApproximately(8, 0.01); f.SortKey.Should().Be(EventSortKey.ScheduledAt); f.SortDescending.Should().BeFalse(); } [Fact] public void UpdatePreMatch_raises_OnChange_when_value_changes() { var state = new EventBrowsingState(); var fired = 0; state.OnChange += () => fired++; var next = state.PreMatch with { SearchTerm = "Real Madrid" }; state.UpdatePreMatch(next); fired.Should().Be(1); state.PreMatch.SearchTerm.Should().Be("Real Madrid"); } [Fact] public void UpdatePreMatch_does_not_raise_when_value_unchanged() { var state = new EventBrowsingState(); var fired = 0; state.OnChange += () => fired++; state.UpdatePreMatch(state.PreMatch with { }); fired.Should().Be(0); } [Fact] public void Live_and_PreMatch_filters_are_independent() { var state = new EventBrowsingState(); state.UpdateLive(state.Live with { SearchTerm = "live-only" }); state.PreMatch.SearchTerm.Should().BeEmpty(); state.Live.SearchTerm.Should().Be("live-only"); } }