コード例 #1
0
    public void TestDontSendCommandTwice()
    {
        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);
        realCommandSender.Reset();

        sender.SendCommands();

        Assert.That(realCommandSender.commands.Contains(aCommand), Is.False);
    }
コード例 #2
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);
    }