public async Task ReturnSuccessForValidData() { var gameRoundRepoMock = GameRoundsRepositoryMock.Create(); var playersRepoMock = PlayersRepositoryMock.Create(); var rule = new RoundOwnerRule(gameRoundRepoMock.Object, playersRepoMock.Object); var request = new RequestConcrete { GameId = 1, GameRoundId = 1, UserId = 1 }; var result = await rule.Validate(request); Assert.NotNull(result); Assert.True(result.IsSuccessful); Assert.Null(result.Error); }
public async Task ReturnFailureForInvalidUser() { var gameRoundRepoMock = GameRoundsRepositoryMock.Create( isRoundOwner: false); var playersRepoMock = PlayersRepositoryMock.Create(); var rule = new RoundOwnerRule(gameRoundRepoMock.Object, playersRepoMock.Object); var request = new RequestConcrete { GameId = 1, GameRoundId = 1, UserId = 1 }; var result = await rule.Validate(request); Assert.NotNull(result); Assert.False(result.IsSuccessful); Assert.Equal(ValidatorErrors.Games.InvalidUserAction, result.Error); }