public void TestMoveLeftGameOver() { this.mockedBall = new Mock <IBallModel>(MockBehavior.Default); this.mockedCharacter = new Mock <ICharacterModel>(MockBehavior.Default); this.mockedTimer = new Mock <ITimerModel>(MockBehavior.Default); this.mockedScore = new Mock <IScoreModel>(MockBehavior.Default); this.mockedTimer.Setup(mock => mock.GameOver).Returns(true); this.mockedCharacter.Setup(mock => mock.Blocked).Returns(false); this.mockedCharacter.SetupProperty(mock => mock.PositionX, 10); CharacterLogic characterLogic = new CharacterLogic( this.mockedBall.Object, this.mockedCharacter.Object, this.mockedScore.Object, this.mockedTimer.Object); characterLogic.MoveLeft(); this.mockedCharacter.VerifySet(mock => mock.LeftFoot = It.IsAny <Rect>(), Times.Never()); this.mockedCharacter.VerifySet(mock => mock.RigthFoot = It.IsAny <Rect>(), Times.Never()); Assert.That(this.mockedCharacter.Object.PositionX, Is.EqualTo(10)); }
public async Task TestMoveLeftAsync() { this.mockedBall = new Mock <IBallModel>(MockBehavior.Default); this.mockedCharacter = new Mock <ICharacterModel>(MockBehavior.Default); this.mockedTimer = new Mock <ITimerModel>(MockBehavior.Default); this.mockedScore = new Mock <IScoreModel>(MockBehavior.Default); this.mockedTimer.Setup(mock => mock.GameOver).Returns(false); this.mockedCharacter.Setup(mock => mock.Blocked).Returns(false); this.mockedCharacter.SetupProperty(mock => mock.PositionX, 10); CharacterLogic characterLogic = new CharacterLogic( this.mockedBall.Object, this.mockedCharacter.Object, this.mockedScore.Object, this.mockedTimer.Object); characterLogic.MoveLeft(); await Task.Delay(1000); this.mockedCharacter.VerifySet(mock => mock.LeftFoot); this.mockedCharacter.VerifySet(mock => mock.RigthFoot); Assert.That(this.mockedCharacter.Object.PositionX, Is.EqualTo(5)); }