internal static async Task <ReceivingProcessingMode> ToReceivingPMode(byte[] value) { using (var stream = new MemoryStream(value)) { return(await AS4XmlSerializer.FromStreamAsync <ReceivingProcessingMode>(stream)); } }
public async Task FilledWithPModeData() { // Arrange var expectedPMode = new SendingProcessingMode(); using (Stream pmodeStream = SerializeExpectedPMode(expectedPMode)) { // Act var actualPMode = await AS4XmlSerializer.FromStreamAsync <SendingProcessingMode>(pmodeStream); // Assert Assert.Equal(expectedPMode.Id, actualPMode.Id); } }
private static async Task <SendingProcessingMode> DeserializeValidPMode(ReceivedMessage receivedMessage) { SendingProcessingMode pmode = await AS4XmlSerializer.FromStreamAsync <SendingProcessingMode>(receivedMessage.UnderlyingStream); ValidationResult result = SendingProcessingModeValidator.Instance.Validate(pmode); if (result.IsValid) { return(pmode); } throw CreateInvalidPModeException(pmode, result); }
private async Task <MessagingContext> OnMessageReceived( ReceivedMessage receivedMessage, CancellationToken cancellationToken) { var actualPMode = await AS4XmlSerializer.FromStreamAsync <SendingProcessingMode>(receivedMessage.UnderlyingStream); Assert.Equal("01-pmode", actualPMode.Id); if (_seriewatch.TrackSerie(maxSerieCount: 3)) { Assert.True(_seriewatch.GetSerie(1) > _seriewatch.GetSerie(0)); _waitHandle.Set(); } return(new EmptyMessagingContext()); }