public async Task Background_CounterDecreasedTest() { var animationState = _mocks.AnimationState(); animationState.Setup(a => a.TimeToNextFrame).Returns(5); var animation = _mocks.Animation(); var loop = getGameLoop(); await loop.UpdateAsync(); animationState.VerifySet(a => a.TimeToNextFrame = 4, Times.Once()); animationState.VerifySet(a => a.TimeToNextFrame = It.IsAny <int>(), Times.Once()); animation.Verify(a => a.NextFrame(), Times.Never); }
public static Mocks Init() { ContainerBuilder builder = new ContainerBuilder(); Mocks mocks = new Mocks(); builder.RegisterInstance(mocks.Animation().Object); builder.RegisterInstance(mocks.AnimationState().Object); builder.RegisterInstance(mocks.GameState().Object); builder.RegisterInstance(mocks.Game().Object); builder.RegisterInstance(mocks.Player().Object); builder.RegisterInstance(mocks.Character().Object); builder.RegisterInstance(mocks.Room().Object); builder.RegisterInstance(mocks.Object().Object); builder.RegisterInstance(mocks.Viewport().Object); builder.RegisterInstance(mocks.Sprite().Object); builder.RegisterInstance(mocks.Image().Object); builder.RegisterInstance(mocks.Input().Object); builder.RegisterInstance(mocks.Cutscene().Object); builder.RegisterInstance(mocks.RoomTransitions().Object); builder.RegisterInstance(mocks.AudioSystem().Object); builder.RegisterInstance(new Mock <IRenderMessagePump> ().Object); builder.RegisterInstance(new Mock <IUpdateMessagePump>().Object); builder.RegisterInstance(new Mock <IGameEvents>().Object); builder.RegisterInstance(new Mock <IDisplayList>().Object); builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource()); mocks.container = builder.Build(); return(mocks); }
public void StartFirstAnimationTest() { foreach (var container in getImplementors()) { Mock <IAnimation> animation = _mocks.Animation(); container.StartAnimation(animation.Object); Assert.AreEqual(animation.Object, container.Animation, "Animation not changed for " + container.GetType().Name); } }