public void TestKeyFrame(ProcessDataPointValue dataPoint) { ProcessDataSet dataSet = new ProcessDataSet("test-publisher", "test001", 123, ProcessDataSet.DataSetType.TimeSeries); dataSet.AddDataPoint(dataPoint); DecodeMessage decoder = new DecodeMessage(); byte[] encodedMeta = dataSet.GetEncodedMetaFrame(new EncodingOptions(), 1, true); byte[] encodedKey = dataSet.GetEncodedKeyFrame(2); NetworkMessage metaNetworkMessage = decoder.ParseBinaryMessage(encodedMeta); Assert.That(metaNetworkMessage, Is.Not.Null); Assert.That(metaNetworkMessage, Is.InstanceOf(typeof(MetaFrame))); Assert.That(metaNetworkMessage.NetworkMessageHeader.UADPFlags.HasFlag(UADPFlags.PayloadHeaderEnabled), Is.False); NetworkMessage keyNetworkMessage = decoder.ParseBinaryMessage(encodedKey); Assert.That(keyNetworkMessage, Is.Not.Null); Assert.That(keyNetworkMessage, Is.InstanceOf(typeof(KeyFrame))); Assert.That(keyNetworkMessage.NetworkMessageHeader.UADPFlags.HasFlag(UADPFlags.PayloadHeaderEnabled), Is.True); KeyFrame decodedKeyMessage = (KeyFrame)keyNetworkMessage; ProcessDataPointValue decodedDataPoint = (ProcessDataPointValue)decodedKeyMessage.Items[0]; Common.AssertDataPointsAreEqual(dataPoint, decodedDataPoint); Assert.That(decodedKeyMessage, Is.Not.Null); Assert.That(decodedKeyMessage.Items, Is.Not.Empty); Assert.That(decodedKeyMessage.Items.Count, Is.EqualTo(1)); Assert.That(decodedKeyMessage.NetworkMessageHeader.UADPFlags.HasFlag(UADPFlags.PayloadHeaderEnabled), Is.True); }
public void KeyFrame(List <ProcessDataPointValue> dataPoints) { ProcessDataSet dataSet = new ProcessDataSet("test-publisher", "test001", 123, ProcessDataSet.DataSetType.TimeSeries); foreach (ProcessDataPointValue dataPoint in dataPoints) { dataSet.AddDataPoint(dataPoint); } DecodeMessage decoder = new DecodeMessage(); byte[] encodedMeta = dataSet.GetEncodedMetaFrame(new EncodingOptions(), 1, true); byte[] encodedKey = dataSet.GetEncodedKeyFrame(2); NetworkMessage metaNetworkMessage = decoder.ParseBinaryMessage(encodedMeta); Assert.That(metaNetworkMessage, Is.Not.Null); Assert.That(metaNetworkMessage, Is.InstanceOf(typeof(MetaFrame))); NetworkMessage keyNetworkMessage = decoder.ParseBinaryMessage(encodedKey); Assert.That(keyNetworkMessage, Is.Not.Null); Assert.That(keyNetworkMessage, Is.InstanceOf(typeof(KeyFrame))); KeyFrame decodedKeyMessage = (KeyFrame)keyNetworkMessage; Assert.That(decodedKeyMessage, Is.Not.Null); Assert.That(decodedKeyMessage.Items, Is.Not.Empty); Assert.That(decodedKeyMessage.Items.Count, Is.EqualTo(dataPoints.Count)); Assert.That(decodedKeyMessage.Items, Is.EqualTo(dataPoints)); }