61114ea31b
Creates the 9-project .NET 8 solution (5 src + 4 test) with Marathon.Domain fully implemented: value objects (SportCode, EventId, OddsRate, OddsValue, BetScope hierarchy), enums (Side, BetType, OddsSource, AnomalyKind), and entities (Sport, Country, League, Event, Bet, OddsSnapshot, EventResult, Anomaly) with all invariants enforced in constructors. 96 domain tests pass (FluentAssertions + xUnit). Directory.Build.props and Directory.Packages.props centralise build settings and NuGet versions. Both Marathon.sln and Marathon.slnx are committed; dotnet build Marathon.sln succeeds with 0 warnings/errors.
42 lines
1016 B
C#
42 lines
1016 B
C#
using FluentAssertions;
|
|
using Marathon.Domain.ValueObjects;
|
|
|
|
namespace Marathon.Domain.Tests.ValueObjects;
|
|
|
|
public sealed class SportCodeTests
|
|
{
|
|
[Fact]
|
|
public void Constructor_CreatesInstance_WhenValueIsPositive()
|
|
{
|
|
var code = new SportCode(6);
|
|
code.Value.Should().Be(6);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(0)]
|
|
[InlineData(-1)]
|
|
[InlineData(int.MinValue)]
|
|
public void Constructor_ThrowsArgumentOutOfRangeException_WhenValueIsZeroOrNegative(int value)
|
|
{
|
|
var act = () => new SportCode(value);
|
|
act.Should().Throw<ArgumentOutOfRangeException>()
|
|
.WithParameterName("value");
|
|
}
|
|
|
|
[Fact]
|
|
public void ToString_ReturnsStringRepresentationOfValue()
|
|
{
|
|
var code = new SportCode(22723);
|
|
code.ToString().Should().Be("22723");
|
|
}
|
|
|
|
[Fact]
|
|
public void Equality_IsValueBased()
|
|
{
|
|
var a = new SportCode(6);
|
|
var b = new SportCode(6);
|
|
a.Should().Be(b);
|
|
a.Should().NotBeSameAs(b);
|
|
}
|
|
}
|