public void BinaryUDPPackageWriterTestMethod() { BinaryDataTransferGraphSenderFixture _binaryStreamObservable = new BinaryDataTransferGraphSenderTest(); using (BinaryEncoder _writer = new BinaryEncoder(_binaryStreamObservable, new Helpers.UABinaryEncoderImplementation(), MessageLengthFieldTypeEnum.TwoBytes)) { Assert.AreEqual <int>(0, _binaryStreamObservable.m_NumberOfSentBytes); Assert.AreEqual <int>(0, _binaryStreamObservable.NumberOfAttachToNetwork); Assert.AreEqual <int>(0, _binaryStreamObservable.m_NumberOfSentMessages); Assert.AreEqual <HandlerState>(HandlerState.Disabled, _binaryStreamObservable.State.State); _writer.AttachToNetwork(); _writer.State.Enable(); Assert.AreEqual <HandlerState>(HandlerState.Operational, _binaryStreamObservable.State.State); Assert.AreEqual <int>(1, _binaryStreamObservable.NumberOfAttachToNetwork); Assert.AreEqual <int>(0, _binaryStreamObservable.m_NumberOfSentBytes); Assert.AreEqual <int>(0, _binaryStreamObservable.m_NumberOfSentMessages); ProducerBindingFixture _binding = new ProducerBindingFixture() { Value = string.Empty }; int _sentItems = 0; Guid m_Guid = CommonDefinitions.TestGuid; DataSelector _testDataSelector = new DataSelector() { DataSetWriterId = CommonDefinitions.DataSetId, PublisherId = CommonDefinitions.TestGuid }; ((IMessageWriter)_writer).Send((x) => { _binding.Value = CommonDefinitions.TestValues[x]; _sentItems++; return(_binding); }, Convert.ToUInt16(CommonDefinitions.TestValues.Length), ulong.MaxValue, FieldEncodingEnum.VariantFieldEncoding, _testDataSelector, 0, CommonDefinitions.TestMinimalDateTime, new ConfigurationVersionDataType() { MajorVersion = 0, MinorVersion = 0 } ); Assert.AreEqual(CommonDefinitions.TestValues.Length, _sentItems); Assert.AreEqual <int>(1, _binaryStreamObservable.NumberOfAttachToNetwork); Assert.AreEqual <int>(115, _binaryStreamObservable.m_NumberOfSentBytes); Assert.AreEqual <int>(1, _binaryStreamObservable.m_NumberOfSentMessages); byte[] _shouldBeInBuffer = CommonDefinitions.GetTestBinaryArrayVariant4Consumer(); CollectionAssert.AreEqual(_binaryStreamObservable.Buffer, _shouldBeInBuffer); } }