public void BuildStack() { _serial = new SerialTransport("COM7", 115200); _nibusDataCodec = new NibusDataCodec(); _nmsCodec = new NmsCodec(); _releaser = new List <IDisposable> { _nmsCodec, _nibusDataCodec, _serial }; _nmsCodec.ConnectTo(_nibusDataCodec); _nibusDataCodec.ConnectTo(_serial); _serial.Open(); }
public void EncodeDecode_Equal( [ValueSource("Addresses")] Address destanation, [ValueSource("Addresses")] Address source, [Values(PriorityType.Realtime, PriorityType.AboveNormal, PriorityType.Normal, PriorityType.BelowNormal)] PriorityType priority, [Values(ProtocolType.Nms, ProtocolType.Sarp)] ProtocolType protocol) { var codec = new NibusDataCodec(); var datagramOrig = new NibusDatagram(codec, source, destanation, priority, protocol, new byte[] { 1, 2, 3, 4, 6, 7, 8, 9 }); codec.Encoder.Post(datagramOrig); var data = codec.Encoder.Receive(); codec.Decoder.Post(data); var datagramCopy = codec.Decoder.Receive(); Assert.That(datagramOrig.Destanation == datagramCopy.Destanation); Assert.That(datagramOrig.Source == datagramCopy.Source); Assert.That(datagramOrig.Priority == datagramCopy.Priority); Assert.That(datagramOrig.ProtocolType == datagramCopy.ProtocolType); Assert.That(datagramOrig.Data.SequenceEqual(datagramCopy.Data)); }