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.
37 lines
921 B
C#
37 lines
921 B
C#
using FluentAssertions;
|
|
using Marathon.Domain.ValueObjects;
|
|
|
|
namespace Marathon.Domain.Tests.ValueObjects;
|
|
|
|
public sealed class OddsValueTests
|
|
{
|
|
[Theory]
|
|
[InlineData("3.5")]
|
|
[InlineData("213.5")]
|
|
[InlineData("-1.5")]
|
|
[InlineData("-0.5")]
|
|
[InlineData("0.5")]
|
|
public void Constructor_CreatesInstance_WhenValueIsNonZero(string rawValue)
|
|
{
|
|
var value = decimal.Parse(rawValue);
|
|
var oddsValue = new OddsValue(value);
|
|
oddsValue.Value.Should().Be(value);
|
|
}
|
|
|
|
[Fact]
|
|
public void Constructor_ThrowsArgumentOutOfRangeException_WhenValueIsZero()
|
|
{
|
|
var act = () => new OddsValue(0m);
|
|
act.Should().Throw<ArgumentOutOfRangeException>()
|
|
.WithParameterName("value");
|
|
}
|
|
|
|
[Fact]
|
|
public void Equality_IsValueBased()
|
|
{
|
|
var a = new OddsValue(3.5m);
|
|
var b = new OddsValue(3.5m);
|
|
a.Should().Be(b);
|
|
}
|
|
}
|