public void CreatorTestMethod() { HeaderWriterTest _htw = new HeaderWriterTest(x => { }); HeaderWriter _hw = new HeaderWriter(_htw, 16); Assert.AreEqual(16, _htw.Position); }
public void EndPositionTestMethod() { ushort _length = 16; HeaderWriterTest _htw = new HeaderWriterTest(x => { }); HeaderWriter _hw = new HeaderWriter(_htw, _length); _htw.Write((byte)0x1); _htw.Write((byte)0x1); _htw.Write((byte)0x1); _htw.Write((byte)0x1); Assert.AreEqual<long>(_length + 4, _htw.Position); }
public void EndPositionTestMethod() { ushort _length = 16; HeaderWriterTest _htw = new HeaderWriterTest(x => { }); HeaderWriter _hw = new HeaderWriter(_htw, _length); _htw.Write((byte)0x1); _htw.Write((byte)0x1); _htw.Write((byte)0x1); _htw.Write((byte)0x1); Assert.AreEqual <long>(_length + 4, _htw.Position); }
public void ProducerPacketHeaderTestMethod() { HeaderWriterTest _writer = new HeaderWriterTest(x => { }, m_StartPosition); PacketHeader _header = PacketHeader.GetProducerPacketHeader(_writer, CommonDefinitions.TestGuid, new UInt16[] { 0xFFFF }); Assert.IsNotNull(_header); Assert.AreEqual<System.UInt32>(0xFFFF, _header.DataSetWriterIds[0]); Assert.AreEqual<byte>(1, _header.MessageCount); Assert.AreEqual<long>(m_StartPosition + 24, _writer.Position); _writer.Write(0xCCCC); _writer.Write(0xCCCC); _writer.Write(0xCCCC); _writer.Write(0xCCCC); _header.WritePacketHeader(); Assert.AreEqual<byte>(1, _header.MessageCount); Assert.AreEqual<long>(m_StartPosition + 24 + 16, _writer.Position); _header.WritePacketHeader(); Assert.AreEqual<long>(m_StartPosition + 24 + 16, _writer.Position); _writer.Write(0xCCCC); Assert.AreEqual<long>(m_StartPosition + 24 + 20, _writer.Position); }
public void ProducerPacketHeaderTestMethod() { HeaderWriterTest _writer = new HeaderWriterTest(x => { }, m_StartPosition); PacketHeader _header = PacketHeader.GetProducerPacketHeader(_writer, CommonDefinitions.TestGuid, new UInt16[] { 0xFFFF }); Assert.IsNotNull(_header); Assert.AreEqual <System.UInt32>(0xFFFF, _header.DataSetWriterIds[0]); Assert.AreEqual <byte>(1, _header.MessageCount); Assert.AreEqual <long>(m_StartPosition + 24, _writer.Position); _writer.Write(0xCCCC); _writer.Write(0xCCCC); _writer.Write(0xCCCC); _writer.Write(0xCCCC); _header.WritePacketHeader(); Assert.AreEqual <byte>(1, _header.MessageCount); Assert.AreEqual <long>(m_StartPosition + 24 + 16, _writer.Position); _header.WritePacketHeader(); Assert.AreEqual <long>(m_StartPosition + 24 + 16, _writer.Position); _writer.Write(0xCCCC); Assert.AreEqual <long>(m_StartPosition + 24 + 20, _writer.Position); }