예제 #1
0
        public void ShouldInitBlinkerObject()
        {
            //Given
            Board      board   = new Board(5, 5, new ConwaysRule());
            IGoLObject blinker = GoLObjectFactory.Create(GoLPatterns.Blinker);
            GoLHelper  helper  = new GoLHelper(5, 5);

            //When
            blinker.Fill(board, 1, 2);
            //Then
            board.Table.ShouldBe(helper.CreateBlinkerFirstState(1, 2));
        }
예제 #2
0
        public void ShouldInvokeBoardGeneration()
        {
            //Given
            Board      board   = new Board(5, 5, new ConwaysRule());
            IGoLObject blinker = GoLObjectFactory.Create(GoLPatterns.Blinker);
            GoLHelper  helper  = new GoLHelper(5, 5);

            //When
            blinker.Fill(board, 1, 2);
            board.NextGeneration();
            //Then
            board.Table.ShouldBe(helper.CreateBlinkerSecondState(2, 1));
        }
예제 #3
0
        public void BlockShouldBeTheSameBlock()
        {
            //Given
            Board      board  = new Board(4, 4, new ConwaysRule());
            IGoLObject block  = GoLObjectFactory.Create(GoLPatterns.Block);
            GoLHelper  helper = new GoLHelper(4, 4);

            //When
            block.Fill(board, 1, 1);
            board.NextGeneration();
            board.NextGeneration();
            //Then
            board.Table.ShouldBe(helper.CreateBlock(1, 1));
        }
예제 #4
0
        public void BlinkerAfter2GenerationShouldReturnToInitState()
        {
            //Given
            Board      board   = new Board(5, 5, new ConwaysRule());
            IGoLObject blinker = GoLObjectFactory.Create(GoLPatterns.Blinker);
            GoLHelper  helper  = new GoLHelper(5, 5);

            //When
            blinker.Fill(board, 1, 2);
            board.NextGeneration();
            board.NextGeneration();
            //Then
            board.Table.ShouldBe(helper.CreateBlinkerFirstState(1, 2));
        }