Exemplo n.º 1
0
        public void Memory_SetRecall()
        {
            ArgumentOutOfRangeException ex = Assert.Throws <ArgumentOutOfRangeException>(
                delegate { ViscaMemorySet presetBadCmd = new ViscaMemorySet(id, 9); });

            ViscaMemorySet presetCmd = new ViscaMemorySet(id, 5);

            visca.EnqueueCommand(presetCmd);

            Assert.That(sendQueue.TryTake(out byte[] memorySetPacket, 100), Is.True, "Timeout on sending data for Memory Set command");
            Assert.That(memorySetPacket.SequenceEqual(new byte[] { 0x81, 0x01, 0x04, 0x3f, 0x01, 0x05, 0xff }), Is.True, "Memory Set 5 bytes sequence does not match expected");

            // Respond Completion
            visca.ProcessIncomingData(new byte[] { 0x90, 0x50, 0xFF });

            ViscaMemoryRecall recallCmd = new ViscaMemoryRecall(id, 3);

            visca.EnqueueCommand(recallCmd);

            Assert.That(sendQueue.TryTake(out byte[] memoryRecallPacket, 100), Is.True, "Timeout on sending data for Memory Recall command");
            Assert.That(memoryRecallPacket.SequenceEqual(new byte[] { 0x81, 0x01, 0x04, 0x3f, 0x02, 0x03, 0xff }), Is.True, "Memory Recall 3 bytes sequence does not match expected");

            // Respond Completion
            visca.ProcessIncomingData(new byte[] { 0x90, 0x50, 0xFF });
        }
Exemplo n.º 2
0
        public void ViscaDynamicCloneCommandComparsions()
        {
            ViscaMemoryRecall recallCmd = new ViscaMemoryRecall(0x01, 0x01);

            recallCmd.UsePreset(0x02);

            ViscaCommand recallCloneCmd = recallCmd.Clone();

            Assert.That(recallCloneCmd != null, Is.True, "Clonned Command != null");
            Assert.That(recallCloneCmd == null, Is.False, "Clonned Command == null");
            Assert.That(null == recallCloneCmd, Is.False, "null == Clonned Command");

            recallCmd.UsePreset(0x03);
            Assert.That(recallCmd == recallCloneCmd, Is.False, "recallCmd with Preset 3 and Clonned Command with Preset 2 are equal");

            recallCmd.UsePreset(0x02);
            Assert.That(recallCmd == recallCloneCmd, Is.True, "recallCmd with Preset 2 and Clonned Command with Preset 2 are not equal");
        }