public void MinesArowndBigTest() { var model = new MineField(5); var obj = new PrivateObject(model); obj.SetField("field", CreateBigTestArray()); var mine = obj.Invoke("MineCountAround", new object[] { 2, 2 }); Assert.AreEqual(8, (int)mine); mine = obj.Invoke("MineCountAround", new object[] { 0, 0 }); Assert.AreEqual(1, (int)mine); mine = obj.Invoke("MineCountAround", new object[] { 0, 1 }); Assert.AreEqual(2, (int)mine); mine = obj.Invoke("MineCountAround", new object[] { 0, 2 }); Assert.AreEqual(3, (int)mine); mine = obj.Invoke("MineCountAround", new object[] { 1, 2 }); Assert.AreEqual(4, (int)mine); mine = obj.Invoke("MineCountAround", new object[] { 4, 4 }); Assert.AreEqual(1, (int)mine); mine = obj.Invoke("MineCountAround", new object[] { 3, 3 }); Assert.AreEqual(2, (int)mine); mine = obj.Invoke("MineCountAround", new object[] { 3, 2 }); Assert.AreEqual(4, (int)mine); }
public void MinesArowndTest() { var model = new MineField(2); var obj = new PrivateObject(model); obj.SetField("field", CreateTestArray0Mine()); var mine = obj.Invoke("MineCountAround", new object[] { 0, 0 }); Assert.AreEqual(0, (int)mine); obj.SetField("field", CreateTestArray3Mine()); mine = obj.Invoke("MineCountAround", new object[] { 0, 0 }); Assert.AreEqual(3, (int)mine); obj.SetField("field", CreateTestArray3MineApper()); mine = obj.Invoke("MineCountAround", new object[] { 1, 1 }); Assert.AreEqual(3, (int)mine); }