public void TestSendEmptyCommandIfLockstepAndNoCommands() { var lockstep = NSubstitute.Substitute.For <LockstepUpdate> (); var realCommandSender = new CommandSenderProcessorMock(); lockstep.GetNextLockstepFrame().Returns(5); CommandQueue sender = new CommandQueueBase(lockstep, realCommandSender); sender.SendCommands(); Assert.That(realCommandSender.emptyCalled, Is.True); }
public void TestSendCommandIfLockstep() { var lockstep = NSubstitute.Substitute.For <LockstepUpdate> (); var realCommandSender = new CommandSenderProcessorMock(); var aCommand = new CommandBase(); CommandQueue sender = new CommandQueueBase(lockstep, realCommandSender); sender.EnqueueCommand(aCommand); sender.SendCommands(); Assert.That(realCommandSender.commands.Contains(aCommand), Is.True); }
public void TestIsReadyWhenLockstep() { var lockstep = NSubstitute.Substitute.For <LockstepUpdate> (); var realCommandSender = NSubstitute.Substitute.For <CommandSender> (); lockstep.IsLastFrameForNextLockstep().Returns(false); CommandQueue sender = new CommandQueueBase(lockstep, realCommandSender); Assert.That(sender.IsReady(), Is.False); lockstep.ReceivedWithAnyArgs().IsLastFrameForNextLockstep(); lockstep.IsLastFrameForNextLockstep().Returns(true); Assert.That(sender.IsReady(), Is.True); lockstep.ReceivedWithAnyArgs().IsLastFrameForNextLockstep(); }