public void onTelegramReceived9Test()
        {
            SerialPortMock        serialPort = new SerialPortMock();
            NuvoTelegram_Accessor target     = new NuvoTelegram_Accessor(serialPort);

            serialPort.passDataToTestClass("...\r.......COMAND\r.");
            serialPort.passDataToTestClass("...\r.......COMAND\r.");
            Assert.IsTrue(target._currentTelegramBuffer.Length == 0);
        }
        public void onTelegramReceived9Test()
        {
            SerialPortMock serialPort = new SerialPortMock();
            NuvoTelegram   target     = new NuvoTelegram(serialPort);

            serialPort.passDataToTestClass("...\r.......COMAND\r.");
            serialPort.passDataToTestClass("...\r.......COMAND\r.");
            // not supported anymore; quick-fix, uncomment unit test ->  Assert.IsTrue(target._currentTelegramBuffer.Length == 0);
        }
        public void onTelegramReceived6Test()
        {
            SerialPortMock serialPort = new SerialPortMock();
            NuvoTelegram   target     = new NuvoTelegram(serialPort);

            target.Open(new SerialPortConnectInformation("COM1"));

            serialPort.passDataToTestClass("...#\r...");
            // not supported anymore; quick-fix, uncomment unit test ->  Assert.IsTrue(target._currentTelegramBuffer.Length == 3);   // telegram buffer contains 3 charachters
        }
        public void onTelegramReceived4Test()
        {
            SerialPortMock      serialPort = new SerialPortMock();
            NuvoCommandTelegram target     = new NuvoCommandTelegram(serialPort);

            target.Open(new SerialPortConnectInformation("COM1"));
            target.onTelegramReceived += new TelegramEventHandler(serialPort_TelegramReceived);

            serialPort.passDataToTestClass("...#COMAND1\r#COM");
            Assert.IsTrue(_eventRaisedCount == 1);                                      // event has been raised 1 times
            serialPort.passDataToTestClass("AND2\r#COMAND3\r#COMAN");
            Assert.IsTrue(_eventRaisedCount == 3);                                      // event has been raised 3 times
            serialPort.passDataToTestClass("D4\r....#COMAND5\r...#");
            Assert.IsTrue(_eventRaisedCount == 5);                                      // event has been raised 5 times
            serialPort.passDataToTestClass("COMAND6\r...");
            Assert.IsTrue(_eventRaisedCount == 6);                                      // event has been raised 6 times
            Assert.IsTrue(_nuvoTelegramEventArgs.Message.CompareTo("COMAND6") == 0);    // telegram is equal "COMAND6"
            Assert.IsTrue(_eventMessageString.CompareTo("COMAND1COMAND2COMAND3COMAND4COMAND5COMAND6") == 0);
        }
        public void onTelegramReceived6Test()
        {
            SerialPortMock        serialPort = new SerialPortMock();
            NuvoTelegram_Accessor target     = new NuvoTelegram_Accessor(serialPort);

            target.Open(new SerialPortConnectInformation("COM1"));

            serialPort.passDataToTestClass("...#\r...");
            Assert.IsTrue(target._currentTelegramBuffer.Length == 3);   // telegram buffer contains 3 charachters
        }
        public void onTelegramReceived8Test()
        {
            SerialPortMock      serialPort = new SerialPortMock();
            NuvoCommandTelegram target     = new NuvoCommandTelegram(serialPort);

            target.Open(new SerialPortConnectInformation("COM1"));
            target.onTelegramReceived += new TelegramEventHandler(serialPort_TelegramReceived);

            serialPort.passDataToTestClass("...\r...#....#COMAND\r.");
            Assert.IsTrue(_eventRaisedCount == 1);                                   // event has been raised 1 times
            Assert.IsTrue(_nuvoTelegramEventArgs.Message.CompareTo("COMAND") == 0);  // telegram is equal "COMAND"
        }
        public void onTelegramReceived1Test()
        {
            SerialPortMock      serialPort = new SerialPortMock();
            NuvoCommandTelegram target     = new NuvoCommandTelegram(serialPort);

            target.Open(new SerialPortConnectInformation("COM1"));
            target.onTelegramReceived += new TelegramEventHandler(serialPort_TelegramReceived);

            serialPort.passDataToTestClass("#RET\r");
            Assert.IsTrue(_eventRaised);                                         // event has been raised
            Assert.IsTrue(_eventRaisedCount == 1);                               // event has been raised just once
            Assert.IsTrue(_nuvoTelegramEventArgs.Message.Length == 3);           // telegram length is 3 (= RET)
            Assert.IsTrue(_nuvoTelegramEventArgs.Message.CompareTo("RET") == 0); // telegram is equal "RET"
        }