public void TryDoStep_ShouldDoIndicatedStartIndexFirst() { // Arrange var startIndex = (4, 4); var square = new Mock <ISquare>(); square.SetupGet(x => x.IsNumber).Returns(true); square.SetupGet(x => x.Number).Returns(0); var mapHandler = new Mock <IMapHandler>(); mapHandler .Setup(x => x.GetSquare(startIndex)) .Returns(square.Object); // Act var simpleEngine = new SimpleEngine(mapHandler.Object, startIndex); var result = simpleEngine.TryDoStep(null, out _, out _); // Assert Assert.IsTrue(result); mapHandler.Verify(x => x.GetSquare(startIndex), Times.Once); mapHandler.Verify(x => x.Click(square.Object), Times.Once); mapHandler.Verify(x => x.GetNumberSplat(square.Object), Times.Once); square.VerifyGet(x => x.IsNumber, Times.Once); square.VerifyGet(x => x.Number, Times.Once); mapHandler.VerifyNoOtherCalls(); }
public void TryDoStep_ShouldDoRandomStartIndexFirst_IfNotSupplied() { // Arrange var mapHandler = new Mock <IMapHandler>(); mapHandler .Setup(x => x.GetRandomSquare()) .Returns(new TestSquare { IsNumber = true, Number = 0 }); // Act var simpleEngine = new SimpleEngine(mapHandler.Object); var result = simpleEngine.TryDoStep(null, out _, out _); // Assert Assert.IsTrue(result); mapHandler.Verify(x => x.GetRandomSquare(), Times.Once); mapHandler.Verify(x => x.Click(It.IsAny <ISquare>()), Times.Once); mapHandler.Verify(x => x.GetNumberSplat(It.IsAny <ISquare>()), Times.Once); mapHandler.VerifyNoOtherCalls(); }