Before changing Piece[,] to Dictionary<string,Piece>

This commit is contained in:
2021-07-26 06:28:56 -05:00
parent f8f779e84c
commit 178cb00253
73 changed files with 1537 additions and 1418 deletions

View File

@@ -0,0 +1,15 @@
using FluentValidation;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
namespace Gameboard.ShogiUI.Sockets.Services.RequestValidators
{
public class CreateGameRequestValidator : AbstractValidator<CreateGameRequest>
{
public CreateGameRequestValidator()
{
RuleFor(_ => _.Action).Equal(ClientAction.CreateGame);
RuleFor(_ => _.GameName).NotEmpty();
}
}
}

View File

@@ -0,0 +1,15 @@
using FluentValidation;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
namespace Gameboard.ShogiUI.Sockets.Services.RequestValidators
{
public class JoinByCodeRequestValidator : AbstractValidator<JoinByCodeRequest>
{
public JoinByCodeRequestValidator()
{
RuleFor(_ => _.Action).Equal(ClientAction.JoinByCode);
RuleFor(_ => _.JoinCode).NotEmpty();
}
}
}

View File

@@ -0,0 +1,15 @@
using FluentValidation;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
namespace Gameboard.ShogiUI.Sockets.Services.RequestValidators
{
public class JoinGameRequestValidator : AbstractValidator<JoinGameRequest>
{
public JoinGameRequestValidator()
{
RuleFor(_ => _.Action).Equal(ClientAction.JoinGame);
RuleFor(_ => _.GameName).NotEmpty();
}
}
}

View File

@@ -0,0 +1,14 @@
using FluentValidation;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
namespace Gameboard.ShogiUI.Sockets.Services.RequestValidators
{
public class ListGamesRequestValidator : AbstractValidator<ListGamesRequest>
{
public ListGamesRequestValidator()
{
RuleFor(_ => _.Action).Equal(ClientAction.ListGames);
}
}
}

View File

@@ -0,0 +1,15 @@
using FluentValidation;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
namespace Gameboard.ShogiUI.Sockets.Services.RequestValidators
{
public class LoadGameRequestValidator : AbstractValidator<LoadGameRequest>
{
public LoadGameRequestValidator()
{
RuleFor(_ => _.Action).Equal(ClientAction.LoadGame);
RuleFor(_ => _.GameName).NotEmpty();
}
}
}

View File

@@ -0,0 +1,23 @@
using FluentValidation;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
namespace Gameboard.ShogiUI.Sockets.Services.RequestValidators
{
public class MoveRequestValidator : AbstractValidator<MoveRequest>
{
public MoveRequestValidator()
{
RuleFor(_ => _.Action).Equal(ClientAction.Move);
RuleFor(_ => _.GameName).NotEmpty();
RuleFor(_ => _.Move.From)
.Null()
.When(_ => _.Move.PieceFromCaptured.HasValue)
.WithMessage("Move.From and Move.PieceFromCaptured are mutually exclusive properties.");
RuleFor(_ => _.Move.From)
.NotEmpty()
.When(_ => !_.Move.PieceFromCaptured.HasValue)
.WithMessage("Move.From and Move.PieceFromCaptured are mutually exclusive properties.");
}
}
}