massive checkpoint
This commit is contained in:
@@ -8,14 +8,14 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoFixture" Version="4.17.0" />
|
||||
<PackageReference Include="FluentAssertions" Version="5.10.3" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
||||
<PackageReference Include="FluentAssertions" Version="6.1.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="3.0.2">
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
using AutoFixture;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Types;
|
||||
using Gameboard.ShogiUI.Sockets.Services.RequestValidators;
|
||||
using Xunit;
|
||||
|
||||
namespace Gameboard.ShogiUI.xUnitTests.RequestValidators
|
||||
{
|
||||
public class MoveRequestValidatorShould
|
||||
{
|
||||
private readonly Fixture fixture;
|
||||
private readonly MoveRequestValidator validator;
|
||||
public MoveRequestValidatorShould()
|
||||
{
|
||||
fixture = new Fixture();
|
||||
validator = new MoveRequestValidator();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PreventInvalidPropertyCombinations()
|
||||
{
|
||||
// Arrange
|
||||
var request = fixture.Create<MoveRequest>();
|
||||
|
||||
// Act
|
||||
var results = validator.Validate(request);
|
||||
|
||||
// Assert
|
||||
using (new AssertionScope())
|
||||
{
|
||||
results.IsValid.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AllowValidPropertyCombinations()
|
||||
{
|
||||
// Arrange
|
||||
var requestWithoutFrom = new MoveRequest()
|
||||
{
|
||||
Action = ClientAction.Move,
|
||||
GameName = "Some game name",
|
||||
Move = new Move()
|
||||
{
|
||||
IsPromotion = false,
|
||||
PieceFromCaptured = WhichPiece.Bishop,
|
||||
To = "A4"
|
||||
}
|
||||
};
|
||||
var requestWithoutPieceFromCaptured = new MoveRequest()
|
||||
{
|
||||
Action = ClientAction.Move,
|
||||
GameName = "Some game name",
|
||||
Move = new Move()
|
||||
{
|
||||
From = "A1",
|
||||
IsPromotion = false,
|
||||
To = "A4"
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
var results = validator.Validate(requestWithoutFrom);
|
||||
var results2 = validator.Validate(requestWithoutPieceFromCaptured);
|
||||
|
||||
// Assert
|
||||
using (new AssertionScope())
|
||||
{
|
||||
results.IsValid.Should().BeTrue();
|
||||
results2.IsValid.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user