public void GetNeighbourStates__InteriorCell_2_2_InFilledGrid__Neighbours3Red2Green3Blue() { var grid = NeighbourStatesTestHelper.MakeFilled4x4RGBGrid(); var cell = grid.Data[2, 2]; var neighbours = new NeighbourStates(grid, cell); var actualStates = neighbours.GetNeighbourStates(); var actualStateCounts = NeighbourStatesTestHelper.GetStateCountsDict(actualStates); var expectedStateCounts = new Dictionary <State, int> { { State.RED, 3 }, { State.GREEN, 2 }, { State.BLUE, 3 }, }; Assert.IsTrue(NeighbourStatesTestHelper.DictsAreEqual(actualStateCounts, expectedStateCounts)); }
public void GetNeighbourStates_EdgeCellTopInFilledGrid_Neighbours2Red1Green2Blue() { var grid = NeighbourStatesTestHelper.MakeFilled4x4RGBGrid(); var cell = grid.Data[0, 2]; var neighbours = new NeighbourStates(grid, cell); var actualStates = neighbours.GetNeighbourStates(); var actualStateCounts = NeighbourStatesTestHelper.GetStateCountsDict(actualStates); var expectedStateCounts = new Dictionary <State, int> { { State.BLUE, 2 }, { State.GREEN, 1 }, { State.RED, 2 } }; Assert.IsTrue(NeighbourStatesTestHelper.DictsAreEqual(actualStateCounts, expectedStateCounts)); }
public void GetNeighbourStates_EdgeCellLeftInFilledGrid_Neighbours2Dead3Red() { var grid = NeighbourStatesTestHelper.MakeFilled4x4RGBGrid(); var cell = grid.Data[2, 0]; var neighbours = new NeighbourStates(grid, cell); var actualStates = neighbours.GetNeighbourStates(); var actualStateCounts = NeighbourStatesTestHelper.GetStateCountsDict(actualStates); var expectedStateCounts = new Dictionary <State, int> { { State.DEAD, 2 }, { State.RED, 3 } }; Assert.IsTrue(NeighbourStatesTestHelper.DictsAreEqual(actualStateCounts, expectedStateCounts)); }
public void GetNeighbourStates_CornerCellBottomRightInFilledGrid_Neighbours1Blue2Green() { var grid = NeighbourStatesTestHelper.MakeFilled4x4RGBGrid(); var cell = grid.Data[3, 3]; var neighbours = new NeighbourStates(grid, cell); var actualStates = neighbours.GetNeighbourStates(); var actualStateCounts = NeighbourStatesTestHelper.GetStateCountsDict(actualStates); var expectedStateCounts = new Dictionary <State, int> { { State.BLUE, 1 }, { State.GREEN, 2 } }; Assert.IsTrue(NeighbourStatesTestHelper.DictsAreEqual(actualStateCounts, expectedStateCounts)); }