public void TestTurnOnForNeighboorsWhenAlreadyOn() { Boolean turnOnCalled = false; CellLogic.TurnOn turnOn = (() => { turnOnCalled = true; }); CellLogic underTest = new CellLogic(turnOn, null, true); underTest.checkForNeighbors(2); UUnitAssert.True(turnOnCalled); }
void AddCellAt(int i, int j) { GUITexture texture = (GUITexture)Instantiate(baseBlock); texture.pixelInset = new Rect(i * 50, j * 50, 50, 50); CellLogic.TurnOn turnOn = (() => { texture.texture = onTexture; }); CellLogic.TurnOff turnOff = () => { texture.texture = offTexture; }; bool isOn = false; if (Random.Range(0, 2) == 0) { texture.texture = onTexture; isOn = true; } else { texture.texture = offTexture; } fieldLogic.AddCellAt(new CellLogic(turnOn, turnOff, isOn), i, j); }