コード例 #1
0
        public void TestUnregisterInstance()
        {
            // Initialize entities
            DataWriter writer = _publisher.CreateDataWriter(_topic);

            Assert.IsNotNull(writer);
            TestStructDataWriter dataWriter = new TestStructDataWriter(writer);

            // Unregister not registered instance
            ReturnCode result = dataWriter.UnregisterInstance(new TestStruct {
                Id = 1
            });

            Assert.AreEqual(ReturnCode.PreconditionNotMet, result);

            // Register an instance
            TestStruct instance1 = new TestStruct {
                Id = 1
            };
            InstanceHandle handle1 = dataWriter.RegisterInstance(instance1);

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle1);

            // Unregister the previous registered instance with the simplest overload
            result = dataWriter.UnregisterInstance(new TestStruct {
                Id = 1
            });
            Assert.AreEqual(ReturnCode.Ok, result);

            // Register a new instance
            TestStruct instance2 = new TestStruct {
                Id = 2
            };
            InstanceHandle handle2 = dataWriter.RegisterInstance(instance2);

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle2);

            // Unregister the previous registered instance with the handle
            result = dataWriter.UnregisterInstance(new TestStruct {
                Id = 2
            }, handle2);
            Assert.AreEqual(ReturnCode.Ok, result);

            // Register a new instance
            TestStruct instance3 = new TestStruct {
                Id = 3
            };
            InstanceHandle handle3 = dataWriter.RegisterInstance(instance3);

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle3);

            // Unregister the previous registered instance with the handle and the timestamp
            result = dataWriter.UnregisterInstance(new TestStruct {
                Id = 3
            }, handle3, DateTime.Now.ToTimestamp());
            Assert.AreEqual(ReturnCode.Ok, result);
        }
コード例 #2
0
        public void TestLookupInstance()
        {
            // Initialize entities
            DataWriter writer = _publisher.CreateDataWriter(_topic);

            Assert.IsNotNull(writer);
            TestStructDataWriter dataWriter = new TestStructDataWriter(writer);

            // Lookup for a non-existing instance
            InstanceHandle handle = dataWriter.LookupInstance(new TestStruct {
                Id = 1
            });

            Assert.AreEqual(InstanceHandle.HandleNil, handle);

            // Register an instance
            InstanceHandle handle1 = dataWriter.RegisterInstance(new TestStruct {
                Id = 1
            });

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle1);

            // Lookup for an existing instance
            handle = dataWriter.LookupInstance(new TestStruct {
                Id = 1
            });
            Assert.AreNotEqual(InstanceHandle.HandleNil, handle);
            Assert.AreEqual(handle1, handle);
        }
コード例 #3
0
        public void TestGetKeyValue()
        {
            // Initialize entities
            DataWriter writer = _publisher.CreateDataWriter(_topic);

            Assert.IsNotNull(writer);
            TestStructDataWriter dataWriter = new TestStructDataWriter(writer);

            // Call GetKeyValue with HandleNil
            TestStruct data   = new TestStruct();
            ReturnCode result = dataWriter.GetKeyValue(data, InstanceHandle.HandleNil);

            Assert.AreEqual(ReturnCode.BadParameter, result);

            // Register an instance
            TestStruct instance = new TestStruct {
                Id = 1
            };
            InstanceHandle handle = dataWriter.RegisterInstance(instance);

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle);

            // Call GetKeyValue
            data   = new TestStruct();
            result = dataWriter.GetKeyValue(data, handle);
            Assert.AreEqual(ReturnCode.Ok, result);
            Assert.AreEqual(1, data.Id);
        }
コード例 #4
0
        public void TestRegisterInstance()
        {
            // Initialize entities
            DataWriter writer = _publisher.CreateDataWriter(_topic);

            Assert.IsNotNull(writer);
            TestStructDataWriter dataWriter = new TestStructDataWriter(writer);

            // Register an instance
            InstanceHandle handle = dataWriter.RegisterInstance(new TestStruct {
                Id = 1
            });

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle);

            // Register an instance with timestamp
            InstanceHandle otherHandle = dataWriter.RegisterInstance(new TestStruct {
                Id = 2
            }, DateTime.Now.ToTimestamp());

            Assert.AreNotEqual(InstanceHandle.HandleNil, otherHandle);
            Assert.AreNotEqual(handle, otherHandle);
        }
コード例 #5
0
        public void TestOnSampleLost()
        {
            // Attach to the event
            int count = 0;

            _listener.SampleLost += (r, s) =>
            {
                Assert.AreEqual(_reader, r);
                Assert.AreEqual(1, s.TotalCount);
                Assert.AreEqual(1, s.TotalCountChange);

                count++;
            };

            // Prepare QoS for the test
            DataReaderQos drQos = new DataReaderQos();

            drQos.Reliability.Kind      = ReliabilityQosPolicyKind.BestEffortReliabilityQos;
            drQos.DestinationOrder.Kind = DestinationOrderQosPolicyKind.BySourceTimestampDestinationOrderQos;
            drQos.History.Kind          = HistoryQosPolicyKind.KeepLastHistoryQos;
            drQos.History.Depth         = 1;
            ReturnCode result = _reader.SetQos(drQos);

            Assert.AreEqual(ReturnCode.Ok, result);

            // Enable entities
            result = _writer.Enable();
            Assert.AreEqual(ReturnCode.Ok, result);

            result = _reader.Enable();
            Assert.AreEqual(ReturnCode.Ok, result);

            // Wait for discovery
            bool found = _writer.WaitForSubscriptions(1, 1000);

            Assert.IsTrue(found);

            // Write two samples of the same instances
            InstanceHandle handle = _dataWriter.RegisterInstance(new TestStruct {
                Id = 1
            });

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle);

            Timestamp time = DateTime.Now.ToTimestamp();

            result = _dataWriter.Write(new TestStruct {
                Id = 1
            }, handle, time);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(100);

            time   = DateTime.Now.Subtract(TimeSpan.FromSeconds(10)).ToTimestamp();
            result = _dataWriter.Write(new TestStruct {
                Id = 1
            }, handle, time);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(1, count);

            // Remove the listener to avoid extra messages
            result = _participant.SetListener(null);
            Assert.AreEqual(ReturnCode.Ok, result);
        }
コード例 #6
0
        public void TestDispose()
        {
            // Initialize entities
            Duration duration = new Duration {
                Seconds = 5
            };

            DataWriterQos qos = new DataWriterQos();

            qos.WriterDataLifecycle.AutodisposeUnregisteredInstances = false;
            DataWriter writer = _publisher.CreateDataWriter(_topic, qos);

            Assert.IsNotNull(writer);
            TestStructDataWriter dataWriter = new TestStructDataWriter(writer);

            Subscriber subscriber = _participant.CreateSubscriber();

            Assert.IsNotNull(subscriber);

            DataReaderQos drQos = new DataReaderQos();

            qos.Reliability.Kind = ReliabilityQosPolicyKind.ReliableReliabilityQos;
            MyDataReaderListener listener   = new MyDataReaderListener();
            DataReader           dataReader = subscriber.CreateDataReader(_topic, drQos, listener);

            Assert.IsNotNull(dataReader);
            int       count     = 0;
            Timestamp timestamp = default;

            listener.DataAvailable += (reader) =>
            {
                List <TestStruct>    samples = new List <TestStruct>();
                List <SampleInfo>    infos   = new List <SampleInfo>();
                TestStructDataReader dr      = new TestStructDataReader(reader);
                ReturnCode           ret     = dr.Take(samples, infos);
                if (ret == ReturnCode.Ok)
                {
                    foreach (var info in infos)
                    {
                        if (info.InstanceState == InstanceStateKind.NotAliveDisposedInstanceState)
                        {
                            count++;
                            if (count == 3)
                            {
                                timestamp = infos.First().SourceTimestamp;
                            }
                        }
                    }
                }
            };

            // Wait for discovery
            writer.WaitForSubscriptions(1, 1000);
            dataReader.WaitForPublications(1, 1000);

            // Dispose an instance that does not exist
            ReturnCode result = dataWriter.Dispose(new TestStruct {
                Id = 1
            }, InstanceHandle.HandleNil);

            Assert.AreEqual(ReturnCode.Error, result);

            // Call dispose with the simplest overload
            TestStruct instance1 = new TestStruct {
                Id = 1
            };

            result = dataWriter.Write(instance1);
            Assert.AreEqual(ReturnCode.Ok, result);

            result = dataWriter.WaitForAcknowledgments(duration);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(0, count);

            result = dataWriter.Dispose(instance1);
            Assert.AreEqual(ReturnCode.Ok, result);

            result = dataWriter.WaitForAcknowledgments(duration);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(1, count);

            // Call dispose with the handle parameter
            TestStruct instance2 = new TestStruct {
                Id = 2
            };
            InstanceHandle handle2 = dataWriter.RegisterInstance(instance2);

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle2);

            result = dataWriter.Write(instance2, handle2);
            Assert.AreEqual(ReturnCode.Ok, result);

            result = dataWriter.WaitForAcknowledgments(duration);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(1, count);

            result = dataWriter.Dispose(instance2, handle2);
            Assert.AreEqual(ReturnCode.Ok, result);

            result = dataWriter.WaitForAcknowledgments(duration);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(2, count);

            // Call dispose with the handle parameter and specific timestamp
            Timestamp  now       = DateTime.Now.ToTimestamp();
            TestStruct instance3 = new TestStruct {
                Id = 3
            };
            InstanceHandle handle3 = dataWriter.RegisterInstance(instance3);

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle3);

            result = dataWriter.Write(instance3, handle3);
            Assert.AreEqual(ReturnCode.Ok, result);

            result = dataWriter.WaitForAcknowledgments(duration);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(2, count);

            result = dataWriter.Dispose(instance3, handle3, now);
            Assert.AreEqual(ReturnCode.Ok, result);

            result = dataWriter.WaitForAcknowledgments(duration);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(3, count);
            Assert.AreEqual(now.Seconds, timestamp.Seconds);
            Assert.AreEqual(now.NanoSeconds, timestamp.NanoSeconds);
        }
コード例 #7
0
        public void TestWrite()
        {
            // Initialize entities
            Duration duration = new Duration {
                Seconds = 5
            };

            DataWriter writer = _publisher.CreateDataWriter(_topic);

            Assert.IsNotNull(writer);
            TestStructDataWriter dataWriter = new TestStructDataWriter(writer);

            Subscriber subscriber = _participant.CreateSubscriber();

            Assert.IsNotNull(subscriber);

            DataReaderQos qos = new DataReaderQos();

            qos.Reliability.Kind = ReliabilityQosPolicyKind.ReliableReliabilityQos;
            MyDataReaderListener listener   = new MyDataReaderListener();
            DataReader           dataReader = subscriber.CreateDataReader(_topic, qos, listener);

            Assert.IsNotNull(dataReader);

            int               count           = 0;
            Timestamp         timestamp       = default;
            ReturnCode        retReadInstance = ReturnCode.Error;
            InstanceHandle    lookupHandle    = InstanceHandle.HandleNil;
            List <TestStruct> samples         = new List <TestStruct>();
            List <SampleInfo> infos           = new List <SampleInfo>();

            listener.DataAvailable += (reader) =>
            {
                count++;
                if (count == 4)
                {
                    TestStructDataReader dr = new TestStructDataReader(reader);

                    lookupHandle = dr.LookupInstance(new TestStruct {
                        Id = count
                    });
                    retReadInstance = dr.ReadInstance(samples, infos, lookupHandle);
                    if (retReadInstance == ReturnCode.Ok && infos != null && infos.Count == 1)
                    {
                        timestamp = infos.First().SourceTimestamp;
                    }
                }
            };

            // Wait for discovery
            writer.WaitForSubscriptions(1, 1000);

            // Write an instance with the simplest overload
            ReturnCode result = dataWriter.Write(new TestStruct {
                Id = 1
            });

            Assert.AreEqual(ReturnCode.Ok, result);

            result = dataWriter.WaitForAcknowledgments(duration);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(10);
            Assert.AreEqual(1, count);

            // Write an instance with the handle parameter as HandleNil
            result = dataWriter.Write(new TestStruct {
                Id = 2
            }, InstanceHandle.HandleNil);
            Assert.AreEqual(ReturnCode.Ok, result);

            result = dataWriter.WaitForAcknowledgments(duration);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(10);
            Assert.AreEqual(2, count);

            // Write an instance with the handle parameter with a previously registered instance
            TestStruct instance = new TestStruct {
                Id = 3
            };
            InstanceHandle handle = dataWriter.RegisterInstance(instance);

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle);

            result = dataWriter.Write(instance, handle);
            Assert.AreEqual(ReturnCode.Ok, result);

            result = dataWriter.WaitForAcknowledgments(duration);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(10);
            Assert.AreEqual(3, count);

            // Write an instance with the handle parameter and the timestamp
            Timestamp  now       = DateTime.Now.ToTimestamp();
            TestStruct instance1 = new TestStruct {
                Id = 4
            };
            InstanceHandle handle1 = dataWriter.RegisterInstance(instance1);

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle1);

            result = dataWriter.Write(instance1, handle1, now);
            Assert.AreEqual(ReturnCode.Ok, result);

            result = dataWriter.WaitForAcknowledgments(duration);
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(10);
            Assert.AreEqual(4, count);
            Assert.AreNotEqual(InstanceHandle.HandleNil, lookupHandle);
            Assert.AreEqual(ReturnCode.Ok, retReadInstance);
            Assert.IsNotNull(infos);
            Assert.AreEqual(1, infos.Count);
            Assert.AreEqual(now.Seconds, timestamp.Seconds);
            Assert.AreEqual(now.NanoSeconds, timestamp.NanoSeconds);
        }
コード例 #8
0
        public void TestOnSampleLost()
        {
            using (ManualResetEventSlim evt = new ManualResetEventSlim(false))
            {
                DataReader reader           = null;
                int        count            = 0;
                int        totalCount       = 0;
                int        totalCountChange = 0;

                // Attach to the event
                _listener.SampleLost += (r, s) =>
                {
                    reader           = r;
                    totalCount       = s.TotalCount;
                    totalCountChange = s.TotalCountChange;

                    count++;

                    evt.Set();
                };

                // Prepare QoS for the test
                DataReaderQos drQos = new DataReaderQos();
                drQos.Reliability.Kind      = ReliabilityQosPolicyKind.BestEffortReliabilityQos;
                drQos.DestinationOrder.Kind = DestinationOrderQosPolicyKind.BySourceTimestampDestinationOrderQos;
                drQos.History.Kind          = HistoryQosPolicyKind.KeepLastHistoryQos;
                drQos.History.Depth         = 1;
                ReturnCode result = _reader.SetQos(drQos);
                Assert.AreEqual(ReturnCode.Ok, result);

                // Enable entities
                result = _writer.Enable();
                Assert.AreEqual(ReturnCode.Ok, result);

                result = _reader.Enable();
                Assert.AreEqual(ReturnCode.Ok, result);

                // Wait for discovery
                Assert.IsTrue(_reader.WaitForPublications(1, 5_000));
                Assert.IsTrue(_writer.WaitForSubscriptions(1, 5_000));

                // Write two samples of the same instances
                InstanceHandle handle = _dataWriter.RegisterInstance(new TestStruct {
                    Id = 1
                });
                Assert.AreNotEqual(InstanceHandle.HandleNil, handle);

                Timestamp time = DateTime.Now.ToTimestamp();
                result = _dataWriter.Write(new TestStruct {
                    Id = 1
                }, handle, time);
                Assert.AreEqual(ReturnCode.Ok, result);

                Thread.Sleep(100);

                time   = DateTime.Now.Subtract(TimeSpan.FromSeconds(10)).ToTimestamp();
                result = _dataWriter.Write(new TestStruct {
                    Id = 1
                }, handle, time);
                Assert.AreEqual(ReturnCode.Ok, result);

                Assert.IsTrue(evt.Wait(20000));
                Assert.AreEqual(1, count);
                Assert.AreEqual(_reader, reader);
                Assert.AreEqual(1, totalCount);
                Assert.AreEqual(1, totalCountChange);

                // Remove the listener to avoid extra messages
                result = _reader.SetListener(null);
                Assert.AreEqual(ReturnCode.Ok, result);
            }
        }
コード例 #9
0
ファイル: PublisherTest.cs プロジェクト: hvuwbmi/openddsharp
        public void TestBeginEndCoherentChanges()
        {
            // Initialize entities
            TestStructTypeSupport support = new TestStructTypeSupport();
            string     typeName           = support.GetTypeName();
            ReturnCode result             = support.RegisterType(_participant, typeName);

            Assert.AreEqual(ReturnCode.Ok, result);

            Topic topic = _participant.CreateTopic(nameof(TestBeginEndCoherentChanges), typeName);

            Assert.IsNotNull(topic);
            Assert.IsNull(topic.GetListener());
            Assert.AreEqual(nameof(TestBeginEndCoherentChanges), topic.Name);
            Assert.AreEqual(typeName, topic.TypeName);

            PublisherQos pQos = new PublisherQos();

            pQos.Presentation.CoherentAccess = true;
            pQos.Presentation.OrderedAccess  = true;
            pQos.Presentation.AccessScope    = PresentationQosPolicyAccessScopeKind.TopicPresentationQos;
            Publisher publisher = _participant.CreatePublisher(pQos);

            Assert.IsNotNull(publisher);

            SubscriberQos sQos = new SubscriberQos();

            sQos.Presentation.CoherentAccess = true;
            sQos.Presentation.OrderedAccess  = true;
            sQos.Presentation.AccessScope    = PresentationQosPolicyAccessScopeKind.TopicPresentationQos;
            Subscriber subscriber = _participant.CreateSubscriber(sQos);

            Assert.IsNotNull(subscriber);

            DataWriter writer = publisher.CreateDataWriter(topic);

            Assert.IsNotNull(writer);
            TestStructDataWriter dataWriter = new TestStructDataWriter(writer);

            DataReaderQos drQos = new DataReaderQos();

            drQos.Reliability.Kind = ReliabilityQosPolicyKind.ReliableReliabilityQos;
            drQos.History.Kind     = HistoryQosPolicyKind.KeepAllHistoryQos;
            DataReader reader = subscriber.CreateDataReader(topic, drQos);

            Assert.IsNotNull(reader);

            TestStructDataReader dataReader = new TestStructDataReader(reader);

            // Call EndCoherentChanges without calling first SuspendPublications
            result = publisher.EndCoherentChanges();
            Assert.AreEqual(ReturnCode.PreconditionNotMet, result);

            // Begin coherent access and write samples
            result = publisher.BeginCoherentChanges();
            Assert.AreEqual(ReturnCode.Ok, result);

            for (int i = 1; i <= 5; i++)
            {
                TestStruct sample = new TestStruct
                {
                    Id        = i,
                    ShortType = (short)i
                };

                InstanceHandle handle = dataWriter.RegisterInstance(sample);
                Assert.AreNotEqual(InstanceHandle.HandleNil, handle);

                result = dataWriter.Write(sample, handle);
                Assert.AreEqual(ReturnCode.Ok, result);
            }

            System.Threading.Thread.Sleep(500);

            // Check that not samples arrived
            List <TestStruct> data        = new List <TestStruct>();
            List <SampleInfo> sampleInfos = new List <SampleInfo>();

            #region OpenDDS Issue
            // Coherent sets for PRESENTATION QoS not Currently implemented on RTPS
            //result = dataReader.Read(data, sampleInfos);
            //Assert.AreEqual(ReturnCode.NoData, result);
            #endregion

            // End coherent access and check the samples
            result = publisher.EndCoherentChanges();
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(500);

            data        = new List <TestStruct>();
            sampleInfos = new List <SampleInfo>();
            result      = dataReader.Read(data, sampleInfos);
            Assert.AreEqual(ReturnCode.Ok, result);

            for (int i = 0; i < data.Count; i++)
            {
                Assert.IsTrue(sampleInfos[i].ValidData);
                Assert.AreEqual(i + 1, data[i].Id);
                Assert.AreEqual(i + 1, data[i].ShortType);
            }
        }
コード例 #10
0
ファイル: PublisherTest.cs プロジェクト: hvuwbmi/openddsharp
        public void TestSuspendResumePublications()
        {
            // Initialize entities
            TestStructTypeSupport support = new TestStructTypeSupport();
            string     typeName           = support.GetTypeName();
            ReturnCode result             = support.RegisterType(_participant, typeName);

            Assert.AreEqual(ReturnCode.Ok, result);

            Topic topic = _participant.CreateTopic(nameof(TestSuspendResumePublications), typeName);

            Assert.IsNotNull(topic);
            Assert.IsNull(topic.GetListener());
            Assert.AreEqual(nameof(TestSuspendResumePublications), topic.Name);
            Assert.AreEqual(typeName, topic.TypeName);

            Publisher publisher = _participant.CreatePublisher();

            Assert.IsNotNull(publisher);

            Subscriber subscriber = _participant.CreateSubscriber();

            Assert.IsNotNull(subscriber);

            DataWriter writer = publisher.CreateDataWriter(topic);

            Assert.IsNotNull(writer);
            TestStructDataWriter dataWriter = new TestStructDataWriter(writer);

            DataReaderQos drQos = new DataReaderQos();

            drQos.Reliability.Kind = ReliabilityQosPolicyKind.ReliableReliabilityQos;
            drQos.History.Kind     = HistoryQosPolicyKind.KeepAllHistoryQos;
            DataReader reader = subscriber.CreateDataReader(topic, drQos);

            Assert.IsNotNull(reader);

            TestStructDataReader dataReader = new TestStructDataReader(reader);

            // Call ResumePublications without calling first SuspendPublications
            result = publisher.ResumePublications();
            Assert.AreEqual(ReturnCode.PreconditionNotMet, result);

            // Suspend publications and write samples
            result = publisher.SuspendPublications();
            Assert.AreEqual(ReturnCode.Ok, result);

            for (int i = 1; i <= 5; i++)
            {
                // OpenDDS issue: cannot register more than one instance during SuspendPublications.
                // Looks like that the control messages are never delivered and the controlTracker never get free during delete_datawriter
                TestStruct sample = new TestStruct
                {
                    Id        = 1,
                    ShortType = (short)i
                };

                InstanceHandle handle = dataWriter.RegisterInstance(sample);
                Assert.AreNotEqual(InstanceHandle.HandleNil, handle);

                result = dataWriter.Write(sample, handle);
                Assert.AreEqual(ReturnCode.Ok, result);
            }

            System.Threading.Thread.Sleep(500);

            // Check that not samples arrived
            List <TestStruct> data        = new List <TestStruct>();
            List <SampleInfo> sampleInfos = new List <SampleInfo>();

            result = dataReader.Read(data, sampleInfos);
            Assert.AreEqual(ReturnCode.NoData, result);

            // Resume publication and check the samples
            result = publisher.ResumePublications();
            Assert.AreEqual(ReturnCode.Ok, result);

            System.Threading.Thread.Sleep(500);

            data        = new List <TestStruct>();
            sampleInfos = new List <SampleInfo>();
            result      = dataReader.Read(data, sampleInfos);
            Assert.AreEqual(ReturnCode.Ok, result);

            for (int i = 0; i < data.Count; i++)
            {
                Assert.IsTrue(sampleInfos[i].ValidData);
                Assert.AreEqual(i + 1, data[i].ShortType);
            }
        }