Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NegativeDecimalEntityTests(TestWebApplicationFactory factory)
: EntityTests<NegativeDecimalEntityTests, NegativeDecimalEntity, Negative<decimal>, Negative<decimal>?, decimal>(factory),
IEntityTestData<decimal>
{
protected override string RoutePrefix => "negative-decimal-entities";
protected override Negative<decimal> Create(decimal raw) => Negative<decimal>.Create(raw);
protected override decimal FirstValid => -5m;
protected override decimal UpdatedValid => -100m;

public static TheoryData<decimal> ValidInputs => new() { -5m, -42m, -10m, -1m, -1.5m, -0.01m };
public static TheoryData<decimal> InvalidInputs => new() { 0m, 1m, 100m, 1.5m };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NegativeDoubleEntityTests(TestWebApplicationFactory factory)
: EntityTests<NegativeDoubleEntityTests, NegativeDoubleEntity, Negative<double>, Negative<double>?, double>(factory),
IEntityTestData<double>
{
protected override string RoutePrefix => "negative-double-entities";
protected override Negative<double> Create(double raw) => Negative<double>.Create(raw);
protected override double FirstValid => -5d;
protected override double UpdatedValid => -100d;

public static TheoryData<double> ValidInputs => new() { -5d, -42d, -10d, -1d, -1.5d, double.MinValue };
public static TheoryData<double> InvalidInputs => new() { 0d, 1d, 100d, 1.5d, double.MaxValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NegativeFloatEntityTests(TestWebApplicationFactory factory)
: EntityTests<NegativeFloatEntityTests, NegativeFloatEntity, Negative<float>, Negative<float>?, float>(factory),
IEntityTestData<float>
{
protected override string RoutePrefix => "negative-float-entities";
protected override Negative<float> Create(float raw) => Negative<float>.Create(raw);
protected override float FirstValid => -5f;
protected override float UpdatedValid => -100f;

public static TheoryData<float> ValidInputs => new() { -5f, -42f, -10f, -1f, -1.5f, float.MinValue };
public static TheoryData<float> InvalidInputs => new() { 0f, 1f, 100f, 1.5f, float.MaxValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NegativeLongEntityTests(TestWebApplicationFactory factory)
: EntityTests<NegativeLongEntityTests, NegativeLongEntity, Negative<long>, Negative<long>?, long>(factory),
IEntityTestData<long>
{
protected override string RoutePrefix => "negative-long-entities";
protected override Negative<long> Create(long raw) => Negative<long>.Create(raw);
protected override long FirstValid => -5L;
protected override long UpdatedValid => -100L;

public static TheoryData<long> ValidInputs => new() { -5L, -42L, -10L, -1L, long.MinValue };
public static TheoryData<long> InvalidInputs => new() { 0L, 1L, 100L, long.MaxValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NegativeShortEntityTests(TestWebApplicationFactory factory)
: EntityTests<NegativeShortEntityTests, NegativeShortEntity, Negative<short>, Negative<short>?, short>(factory),
IEntityTestData<short>
{
protected override string RoutePrefix => "negative-short-entities";
protected override Negative<short> Create(short raw) => Negative<short>.Create(raw);
protected override short FirstValid => -5;
protected override short UpdatedValid => -100;

public static TheoryData<short> ValidInputs => new() { (short)-5, (short)-42, (short)-10, (short)-1, short.MinValue };
public static TheoryData<short> InvalidInputs => new() { (short)0, (short)1, (short)100, short.MaxValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NonNegativeDecimalEntityTests(TestWebApplicationFactory factory)
: EntityTests<NonNegativeDecimalEntityTests, NonNegativeDecimalEntity, NonNegative<decimal>, NonNegative<decimal>?, decimal>(factory),
IEntityTestData<decimal>
{
protected override string RoutePrefix => "non-negative-decimal-entities";
protected override NonNegative<decimal> Create(decimal raw) => NonNegative<decimal>.Create(raw);
protected override decimal FirstValid => 0m;
protected override decimal UpdatedValid => 100m;

public static TheoryData<decimal> ValidInputs => new() { 0m, 5m, 42m, 10m, 1.5m, 0.01m };
public static TheoryData<decimal> InvalidInputs => new() { -1m, -100m, -1.5m };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NonNegativeDoubleEntityTests(TestWebApplicationFactory factory)
: EntityTests<NonNegativeDoubleEntityTests, NonNegativeDoubleEntity, NonNegative<double>, NonNegative<double>?, double>(factory),
IEntityTestData<double>
{
protected override string RoutePrefix => "non-negative-double-entities";
protected override NonNegative<double> Create(double raw) => NonNegative<double>.Create(raw);
protected override double FirstValid => 0d;
protected override double UpdatedValid => 100d;

public static TheoryData<double> ValidInputs => new() { 0d, 5d, 42d, 10d, 1.5d, double.MaxValue };
public static TheoryData<double> InvalidInputs => new() { -1d, -100d, -1.5d, double.MinValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NonNegativeFloatEntityTests(TestWebApplicationFactory factory)
: EntityTests<NonNegativeFloatEntityTests, NonNegativeFloatEntity, NonNegative<float>, NonNegative<float>?, float>(factory),
IEntityTestData<float>
{
protected override string RoutePrefix => "non-negative-float-entities";
protected override NonNegative<float> Create(float raw) => NonNegative<float>.Create(raw);
protected override float FirstValid => 0f;
protected override float UpdatedValid => 100f;

public static TheoryData<float> ValidInputs => new() { 0f, 5f, 42f, 10f, 1.5f, float.MaxValue };
public static TheoryData<float> InvalidInputs => new() { -1f, -100f, -1.5f, float.MinValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NonNegativeLongEntityTests(TestWebApplicationFactory factory)
: EntityTests<NonNegativeLongEntityTests, NonNegativeLongEntity, NonNegative<long>, NonNegative<long>?, long>(factory),
IEntityTestData<long>
{
protected override string RoutePrefix => "non-negative-long-entities";
protected override NonNegative<long> Create(long raw) => NonNegative<long>.Create(raw);
protected override long FirstValid => 0L;
protected override long UpdatedValid => 100L;

public static TheoryData<long> ValidInputs => new() { 0L, 5L, 42L, 10L, long.MaxValue };
public static TheoryData<long> InvalidInputs => new() { -1L, -100L, long.MinValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NonNegativeShortEntityTests(TestWebApplicationFactory factory)
: EntityTests<NonNegativeShortEntityTests, NonNegativeShortEntity, NonNegative<short>, NonNegative<short>?, short>(factory),
IEntityTestData<short>
{
protected override string RoutePrefix => "non-negative-short-entities";
protected override NonNegative<short> Create(short raw) => NonNegative<short>.Create(raw);
protected override short FirstValid => 0;
protected override short UpdatedValid => 100;

public static TheoryData<short> ValidInputs => new() { (short)0, (short)5, (short)42, (short)10, short.MaxValue };
public static TheoryData<short> InvalidInputs => new() { (short)-1, (short)-100, short.MinValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NonPositiveDecimalEntityTests(TestWebApplicationFactory factory)
: EntityTests<NonPositiveDecimalEntityTests, NonPositiveDecimalEntity, NonPositive<decimal>, NonPositive<decimal>?, decimal>(factory),
IEntityTestData<decimal>
{
protected override string RoutePrefix => "non-positive-decimal-entities";
protected override NonPositive<decimal> Create(decimal raw) => NonPositive<decimal>.Create(raw);
protected override decimal FirstValid => 0m;
protected override decimal UpdatedValid => -100m;

public static TheoryData<decimal> ValidInputs => new() { 0m, -5m, -42m, -10m, -1.5m, -0.01m };
public static TheoryData<decimal> InvalidInputs => new() { 1m, 100m, 1.5m };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NonPositiveDoubleEntityTests(TestWebApplicationFactory factory)
: EntityTests<NonPositiveDoubleEntityTests, NonPositiveDoubleEntity, NonPositive<double>, NonPositive<double>?, double>(factory),
IEntityTestData<double>
{
protected override string RoutePrefix => "non-positive-double-entities";
protected override NonPositive<double> Create(double raw) => NonPositive<double>.Create(raw);
protected override double FirstValid => 0d;
protected override double UpdatedValid => -100d;

public static TheoryData<double> ValidInputs => new() { 0d, -5d, -42d, -10d, -1.5d, double.MinValue };
public static TheoryData<double> InvalidInputs => new() { 1d, 100d, 1.5d, double.MaxValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NonPositiveFloatEntityTests(TestWebApplicationFactory factory)
: EntityTests<NonPositiveFloatEntityTests, NonPositiveFloatEntity, NonPositive<float>, NonPositive<float>?, float>(factory),
IEntityTestData<float>
{
protected override string RoutePrefix => "non-positive-float-entities";
protected override NonPositive<float> Create(float raw) => NonPositive<float>.Create(raw);
protected override float FirstValid => 0f;
protected override float UpdatedValid => -100f;

public static TheoryData<float> ValidInputs => new() { 0f, -5f, -42f, -10f, -1.5f, float.MinValue };
public static TheoryData<float> InvalidInputs => new() { 1f, 100f, 1.5f, float.MaxValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NonPositiveLongEntityTests(TestWebApplicationFactory factory)
: EntityTests<NonPositiveLongEntityTests, NonPositiveLongEntity, NonPositive<long>, NonPositive<long>?, long>(factory),
IEntityTestData<long>
{
protected override string RoutePrefix => "non-positive-long-entities";
protected override NonPositive<long> Create(long raw) => NonPositive<long>.Create(raw);
protected override long FirstValid => 0L;
protected override long UpdatedValid => -100L;

public static TheoryData<long> ValidInputs => new() { 0L, -5L, -42L, -10L, long.MinValue };
public static TheoryData<long> InvalidInputs => new() { 1L, 100L, long.MaxValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class NonPositiveShortEntityTests(TestWebApplicationFactory factory)
: EntityTests<NonPositiveShortEntityTests, NonPositiveShortEntity, NonPositive<short>, NonPositive<short>?, short>(factory),
IEntityTestData<short>
{
protected override string RoutePrefix => "non-positive-short-entities";
protected override NonPositive<short> Create(short raw) => NonPositive<short>.Create(raw);
protected override short FirstValid => 0;
protected override short UpdatedValid => -100;

public static TheoryData<short> ValidInputs => new() { (short)0, (short)-5, (short)-42, (short)-10, short.MinValue };
public static TheoryData<short> InvalidInputs => new() { (short)1, (short)100, short.MaxValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

// Values are constrained to two decimal places so they round-trip exactly
// through EF Core's default SQL Server decimal(18,2) mapping.
[Collection(IntegrationTestCollection.Name)]
public sealed class PositiveDecimalEntityTests(TestWebApplicationFactory factory)
: EntityTests<PositiveDecimalEntityTests, PositiveDecimalEntity, Positive<decimal>, Positive<decimal>?, decimal>(factory),
IEntityTestData<decimal>
{
protected override string RoutePrefix => "positive-decimal-entities";
protected override Positive<decimal> Create(decimal raw) => Positive<decimal>.Create(raw);
protected override decimal FirstValid => 5m;
protected override decimal UpdatedValid => 100m;

public static TheoryData<decimal> ValidInputs => new() { 5m, 42m, 10m, 1m, 1.5m, 0.01m };
public static TheoryData<decimal> InvalidInputs => new() { 0m, -1m, -100m, -1.5m };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class PositiveDoubleEntityTests(TestWebApplicationFactory factory)
: EntityTests<PositiveDoubleEntityTests, PositiveDoubleEntity, Positive<double>, Positive<double>?, double>(factory),
IEntityTestData<double>
{
protected override string RoutePrefix => "positive-double-entities";
protected override Positive<double> Create(double raw) => Positive<double>.Create(raw);
protected override double FirstValid => 5d;
protected override double UpdatedValid => 100d;

public static TheoryData<double> ValidInputs => new() { 5d, 42d, 10d, 1d, 1.5d, double.MaxValue };
public static TheoryData<double> InvalidInputs => new() { 0d, -1d, -100d, -1.5d, double.MinValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class PositiveFloatEntityTests(TestWebApplicationFactory factory)
: EntityTests<PositiveFloatEntityTests, PositiveFloatEntity, Positive<float>, Positive<float>?, float>(factory),
IEntityTestData<float>
{
protected override string RoutePrefix => "positive-float-entities";
protected override Positive<float> Create(float raw) => Positive<float>.Create(raw);
protected override float FirstValid => 5f;
protected override float UpdatedValid => 100f;

public static TheoryData<float> ValidInputs => new() { 5f, 42f, 10f, 1f, 1.5f, float.MaxValue };
public static TheoryData<float> InvalidInputs => new() { 0f, -1f, -100f, -1.5f, float.MinValue };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using StrongTypes.Api.Entities;
using StrongTypes.Api.IntegrationTests.Infrastructure;
using Xunit;

namespace StrongTypes.Api.IntegrationTests.Tests;

[Collection(IntegrationTestCollection.Name)]
public sealed class PositiveLongEntityTests(TestWebApplicationFactory factory)
: EntityTests<PositiveLongEntityTests, PositiveLongEntity, Positive<long>, Positive<long>?, long>(factory),
IEntityTestData<long>
{
protected override string RoutePrefix => "positive-long-entities";
protected override Positive<long> Create(long raw) => Positive<long>.Create(raw);
protected override long FirstValid => 5L;
protected override long UpdatedValid => 100L;

public static TheoryData<long> ValidInputs => new() { 5L, 42L, 10L, 1L, long.MaxValue };
public static TheoryData<long> InvalidInputs => new() { 0L, -1L, -100L, long.MinValue };
}
Loading
Loading