Ejemplo n.º 1
0
        void GivenPlayerHasNoMoreTiles()
        {
            var validationResult = new GoValidationResult()
            {
                IsValid = true
            };

            goValidator.ValidateGo(game).Returns(validationResult);
        }
Ejemplo n.º 2
0
        void GivenAValidGo()
        {
            var validationResult = new GoValidationResult()
            {
                IsValid = true, Message = "go is valid"
            };

            goValidator.ValidateGo(game).Returns(validationResult);
        }
Ejemplo n.º 3
0
        void GivenAnotherPlayerHasNoTiles()
        {
            var validationResult = new GoValidationResult()
            {
                IsValid = true
            };

            goValidator.ValidateGo(game).Returns(validationResult);
            game.CurrentPlayer().Tiles.Add(new Tile());
        }
Ejemplo n.º 4
0
        void GivenAGoScored12Points()
        {
            var validationResult = new GoValidationResult()
            {
                IsValid = true
            };

            goValidator.ValidateGo(game).Returns(validationResult);
            goScorer.ScoreGo(Arg.Any <IEnumerable <GoWord> >()).Returns(12);
        }
Ejemplo n.º 5
0
        void GivenAValidGoWithAPlayerTilePlacedOnBoard()
        {
            game.CurrentPlayer().Tiles.Add(new Tile('A')
            {
                Location = "board", BoardPositionX = 7, BoardPositionY = 7
            });
            var validationResult = new GoValidationResult()
            {
                IsValid = true
            };

            goValidator.ValidateGo(game).Returns(validationResult);
        }
Ejemplo n.º 6
0
        void GivenAllPlayersHaveTilesLeft()
        {
            var validationResult = new GoValidationResult()
            {
                IsValid = true
            };

            goValidator.ValidateGo(game).Returns(validationResult);
            game.Players.ForEach(player =>
            {
                player.Tiles.Add(new Tile());
            });
        }
Ejemplo n.º 7
0
        public void Setup()
        {
            game            = new GameFactory(Substitute.For <IDateTimeOffset>()).NewGame("Player");
            goValidator     = Substitute.For <IGoValidator>();
            drawer          = Substitute.For <ITileDrawer>();
            goWordFinder    = Substitute.For <IGoWordFinder>();
            goWordValidator = Substitute.For <IGoWordValidator>();
            goScorer        = Substitute.For <IGoScorer>();
            goMessageMaker  = Substitute.For <IGoMessageMaker>();
            goHandler       = new GoHandler(goValidator, drawer, goWordFinder, goWordValidator, goScorer, goMessageMaker);
            var goWordValidatorResult = new GoValidationResult()
            {
                IsValid = true
            };

            goWordValidator.ValidateWords(Arg.Any <IEnumerable <GoWord> >()).Returns(goWordValidatorResult);
        }
Ejemplo n.º 8
0
        void GivenAValidGoWhichHasCreatedSomeWords()
        {
            var validationResult = new GoValidationResult()
            {
                IsValid = true
            };

            goValidator.ValidateGo(game).Returns(validationResult);
            goWords = new List <GoWord>()
            {
                new GoWord()
                {
                    Word = "GOOD"
                },
                new GoWord()
                {
                    Word = "BETTER"
                }
            };
            goWordFinder.FindWords().Returns(goWords);
        }
Ejemplo n.º 9
0
        void GivenAValidGoWhichHasCreatedSomeInvalidWords()
        {
            var validationResult = new GoValidationResult()
            {
                IsValid = true
            };

            goValidator.ValidateGo(game).Returns(validationResult);
            goWords = new List <GoWord>()
            {
                new GoWord()
                {
                    Word = "BETTEREST"
                }
            };
            goWordFinder.FindWords().Returns(goWords);
            var goWordValidatorResult = new GoValidationResult()
            {
                IsValid = false, Message = "BETTEREST is not a word"
            };

            goWordValidator.ValidateWords(goWords).Returns(goWordValidatorResult);
        }
Ejemplo n.º 10
0
 void WhenValidateGo()
 {
     result = validator.ValidateGo(validatable);
 }
Ejemplo n.º 11
0
 public void GivenNoWords_ThenGoIsInvalid()
 {
     result = goWordValidator.ValidateWords(goWords);
     AssertGoIsInvalidWithMessage("No words were made!");
 }