Ejemplo n.º 1
0
        public async Task ReturnFailureResultForMissingGameId()
        {
            var gameRepository = CreateGameRepositoryMock();
            var validator      = new GameRequestValidator(gameRepository);

            var request = new GameRequestConcrete
            {
            };

            var result = await validator.Validate(request);

            Assert.False(result.IsSuccessful);
            Assert.Equal(ValidatorErrors.Games.GameIdRequired, result.Error);
        }
Ejemplo n.º 2
0
        public async Task ReturnSuccessResultForValidData()
        {
            var gameRepository = CreateGameRepositoryMock();
            var validator      = new GameRequestValidator(gameRepository);

            var request = new GameRequestConcrete
            {
                GameId = 1
            };

            var result = await validator.Validate(request);

            Assert.True(result.IsSuccessful);
            Assert.Null(result.Error);
        }
Ejemplo n.º 3
0
        public async Task ReturnFailureResultForGameNotFound()
        {
            var gameRepository = CreateGameRepositoryMock(
                gameExists: false);
            var validator = new GameRequestValidator(gameRepository);

            var request = new GameRequestConcrete
            {
                GameId = 1
            };

            var result = await validator.Validate(request);

            Assert.False(result.IsSuccessful);
            Assert.Equal(ValidatorErrors.Games.GameNotFoundOrInactive, result.Error);
        }