Exemple #1
0
    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);
    }
Exemple #2
0
    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);
    }
Exemple #3
0
    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();
    }