コード例 #1
0
        private UnlimitedBoard CreateSut(ILivingCellFinder livingCellFinder = null,
                                         INeighboursFinder neighboursFinder = null)
        {
            if (livingCellFinder == null)
            {
                livingCellFinder = new LivingCellFinder(neighboursFinder ?? new NeighboursFinder());
            }

            return(new UnlimitedBoard(livingCellFinder));
        }
コード例 #2
0
        public void Find_ReturnsEmpty_ForDictionaryEmpty()
        {
            // Arrange
            Dictionary <int, ICells> rows = CreateEmpty();
            LivingCellFinder         sut  = CreateSut();

            // Act
            IEnumerable <ICellInformation> actual = sut.Find(rows);

            // Assert
            actual.Count().ShouldEqual(0);
        }
コード例 #3
0
        public void Find_ReturnsAliveCells_ForRowsNotEmpty()
        {
            // Arrange
            IEnumerable <ICellInformation> expected = CreateExpectedCellInfos();
            Dictionary <int, ICells>       rows     = CreateNotEmptyRows();
            LivingCellFinder sut = CreateSut();

            // Act
            IEnumerable <ICellInformation> actual = sut.Find(rows);

            // Assert
            Assert.True(expected.SequenceEqual(actual));
        }