public void At_ShouldReturnCellAt()
        {
            //Arrange
            ICell expected = Cell0;

            ICell[]        cells   = { expected };
            CellCollection subject = new CellCollection(cells);

            //Act
            ICell actual = subject.At(new IntOf(0));

            //Assert
            actual.Should().Be(expected);
        }
        public void Clone_ShouldClone()
        {
            //Arrange
            ICell expected = Cell0;

            ICell[]        cells   = { expected };
            CellCollection subject = new CellCollection(cells);

            //Act
            ICellCollection actual = subject.Clone();

            //Assert
            ReferenceEquals(subject, actual).Should().BeFalse();
            ReferenceEquals(subject.At(new IntOf(0)), actual.At(new IntOf(0))).Should().BeTrue();
        }
Пример #3
0
        public void ClaimEndsGame_ShouldClaimCellForPlayer()
        {
            //Arrange
            FakePrinter     fakePrinter      = new FakePrinter.Builder().Build();
            FakeCell        fakeCellBoard    = new FakeCell.Builder().IsSelected(Bool.False).Value("1").Build();
            FakeCell        fakeCellSelected = new FakeCell.Builder().IsSelected(Bool.False).Value("1").Build();
            FakeCell        fakeCellPlayer   = new FakeCell.Builder().AsSelected(fakeCellSelected).Value("1").Build();
            ICellCollection cellCollection   = new CellCollection(new ICell[] { fakeCellBoard });
            FakeGameState   fakeGameState    = new FakeGameState.Builder().IsGameOver(Bool.False).Build();
            FakePlayer      fakePlayer       = new FakePlayer.Builder().Cell(fakeCellPlayer).Build();
            Board           subject          = new Board(cellCollection, fakeGameState, fakePrinter);

            //Act
            subject.ClaimEndsGame(fakeCellBoard, fakePlayer);

            //Assert
            cellCollection.At(new IntOf(0)).Should().NotBe(fakeCellBoard);
        }