public void Test_NIC_MBR_CountMessagesInBuffer()
        {
            string TEST_IPC_TYPE = "TEST_IPC_TYPE_" + Guid.NewGuid().ToString();

            Niawa.IpcController.MmfBufferedWriter writer = new IpcController.MmfBufferedWriter(TEST_IPC_TYPE, TEST_BUFFER_LENGTH, _utilsBus, false);
            Niawa.IpcController.MmfBufferedReader reader = new IpcController.MmfBufferedReader(TEST_IPC_TYPE, TEST_BUFFER_LENGTH, _utilsBus, false);

            writer.StartWriting();
            reader.StartListening();
            System.Threading.Thread.Sleep(100);

            //assertion
            Assert.AreEqual(0, reader.CountMessagesInBuffer(), "Count of messages in buffer expected to be zero before writing message");

            //write some data
            Niawa.IpcController.NiawaMmfContainer msg = new IpcController.NiawaMmfContainer(DateTime.Now, TEST_IPC_TYPE, "test data");
            writer.WriteData(msg);

            System.Threading.Thread.Sleep(500);

            //assertion
            Assert.AreEqual(1, reader.CountMessagesInBuffer(), "Count of messages in buffer expected to be 1 after writing message");

            //retrieve message
            Niawa.IpcController.NiawaMmfContainer msgNew = reader.GetNextMessageFromBuffer();

            //assertion
            Assert.AreEqual(0, reader.CountMessagesInBuffer(), "Count of messages in buffer epxected to be zero after reading message");

            reader.StopListening(true);
            writer.StopWriting(true);
        }
        public void Test_NIC_MBR_GetNextMessageFromBuffer()
        {
            string TEST_IPC_TYPE = "TEST_IPC_TYPE_" + Guid.NewGuid().ToString();

            Niawa.IpcController.MmfBufferedWriter writer = new IpcController.MmfBufferedWriter(TEST_IPC_TYPE, TEST_BUFFER_LENGTH, _utilsBus, false);
            Niawa.IpcController.MmfBufferedReader reader = new IpcController.MmfBufferedReader(TEST_IPC_TYPE, TEST_BUFFER_LENGTH, _utilsBus, false);

            writer.StartWriting();
            reader.StartListening();
            System.Threading.Thread.Sleep(100);

            //assertion
            Assert.AreEqual(0, reader.CountMessagesInBuffer(), "Count of messages in buffer expected to be zero before writing message");

            //write some data
            Niawa.IpcController.NiawaMmfContainer msg = new IpcController.NiawaMmfContainer(DateTime.Now, TEST_IPC_TYPE, "test data");
            writer.WriteData(msg);

            System.Threading.Thread.Sleep(500);

            //assertion
            Assert.AreEqual(1, reader.CountMessagesInBuffer(), "Count of messages in buffer expected to be 1 after writing message");

            //retrieve message
            Niawa.IpcController.NiawaMmfContainer msgNew = reader.GetNextMessageFromBuffer();

            //assertion
            Assert.AreEqual(0, reader.CountMessagesInBuffer(), "Count of messages in buffer expected to be zero after reading message");

            //assertion
            Assert.AreEqual(msg.IpcData, msgNew.IpcData, "Message received from buffer doesn't have the same IpcData");
            Assert.AreEqual(msg.IpcType, msgNew.IpcType, "Message received from buffer doesn't have the same IpcType");
            Assert.AreEqual(msg.RefreshedDate, msgNew.RefreshedDate, "Message received from buffer doesn't have the same RefreshedDate");
            Assert.AreEqual(msg.SerialID, msgNew.SerialID, "Message received from buffer doesn't have the same SerialID");
            Assert.AreEqual(msg.ToString(), msgNew.ToString(), "Message received from buffer doesn't have the same ToString value");

            reader.StopListening(true);
            writer.StopWriting(true);
        }
        public void Test_NIC_MBR_StopListening()
        {
            string TEST_IPC_TYPE = "TEST_IPC_TYPE_" + Guid.NewGuid().ToString();

            Niawa.IpcController.MmfBufferedReader reader = new IpcController.MmfBufferedReader(TEST_IPC_TYPE, TEST_BUFFER_LENGTH, _utilsBus, false);

            reader.StartListening();

            //assertion
            Assert.AreEqual(Niawa.Threading.ThreadStatus.STATUS_STARTED, reader.ThreadStatus.Status, "ThreadStatus doesn't match expectation after starting reader");

            reader.StopListening(true);
            System.Threading.Thread.Sleep(250);

            //assertion
            Assert.AreEqual(Niawa.Threading.ThreadStatus.STATUS_STOPPED, reader.ThreadStatus.Status, "ThreadStatus doesn't match expectation after stopping reader");

            reader.StopListening(true);
        }
        public void Test_NIC_MBR_Prop_ThreadStatus()
        {
            string TEST_IPC_TYPE = "TEST_IPC_TYPE_" + Guid.NewGuid().ToString();

            Niawa.IpcController.MmfBufferedReader reader = new IpcController.MmfBufferedReader(TEST_IPC_TYPE, TEST_BUFFER_LENGTH, _utilsBus, false);

            reader.StartListening();

            //assertion
            Assert.AreEqual(Niawa.Threading.ThreadStatus.STATUS_STARTED, reader.ThreadStatus.Status, "Thread status property doesn't match expectation");

            reader.StopListening(true);
        }