using FluentAssertions; using Marathon.Domain.ValueObjects; namespace Marathon.Domain.Tests.ValueObjects; public sealed class BetScopeTests { [Fact] public void MatchScope_Singleton_IsTheSameInstance() { MatchScope.Instance.Should().BeSameAs(MatchScope.Instance); } [Fact] public void PeriodScope_CreatesInstance_WhenNumberIsPositive() { var scope = new PeriodScope(1); scope.Number.Should().Be(1); } [Theory] [InlineData(0)] [InlineData(-1)] [InlineData(int.MinValue)] public void PeriodScope_ThrowsArgumentOutOfRangeException_WhenNumberIsZeroOrNegative(int number) { var act = () => new PeriodScope(number); act.Should().Throw() .WithParameterName("Number"); } [Fact] public void BetScope_PatternMatching_WorksCorrectly() { BetScope match = MatchScope.Instance; BetScope period = new PeriodScope(2); var matchResult = match switch { MatchScope => "match", PeriodScope(var n) => $"period-{n}", _ => "other", }; var periodResult = period switch { MatchScope => "match", PeriodScope(var n) => $"period-{n}", _ => "other", }; matchResult.Should().Be("match"); periodResult.Should().Be("period-2"); } [Fact] public void PeriodScope_Equality_IsValueBased() { var a = new PeriodScope(1); var b = new PeriodScope(1); a.Should().Be(b); } [Fact] public void MatchScope_And_PeriodScope_AreNotEqual() { BetScope match = MatchScope.Instance; BetScope period = new PeriodScope(1); match.Should().NotBe(period); } }