public void FindAlive_ReturnsEmpty_ForAllDead() { // Arrange Dictionary <int, ICells> rows = CreateEmptyRows(); NeighboursFinder sut = CreateSut(); // Act int actual = sut.NumberOfAliveNeighbours(rows, 0, 0); // Assert actual.ShouldEqual(0); }
public void FindAlive_ReturnsOne_ForOnlyOneIsAlive(int row, int column) { // Arrange Dictionary <int, ICells> rows = CreateEmptyRows(); var cells = new Cells(); cells.SetStatus(column, Cell.Status.Alive); rows.Add(row, cells); NeighboursFinder sut = CreateSut(); // Act int actual = sut.NumberOfAliveNeighbours(rows, 0, 0); // Assert actual.ShouldEqual(1); }
public void FindAlive_ReturnsTwo_ForTwoAreAlive() { // Arrange Dictionary <int, ICells> rows = CreateEmptyRows(); var cells = new Cells(); cells.SetStatus(0, Cell.Status.Alive); cells.SetStatus(-1, Cell.Status.Alive); rows.Add(-1, cells); NeighboursFinder sut = CreateSut(); // Act int actual = sut.NumberOfAliveNeighbours(rows, 0, 0); // Assert actual.ShouldEqual(2); }