public byte[] Parse(DequeueNotificationDto dequeueNotificationDto) { ArgumentNullException.ThrowIfNull(dequeueNotificationDto, nameof(dequeueNotificationDto)); #pragma warning disable CS0618 // Type or member is obsolete var marketOperator = dequeueNotificationDto.MarketOperator is LegacyActorIdDto legacyActorIdDto #pragma warning restore CS0618 // Type or member is obsolete ? legacyActorIdDto.LegacyValue : dequeueNotificationDto.MarketOperator.Value.ToString(); var message = new DequeueContract { DataAvailableNotificationReferenceId = dequeueNotificationDto.DataAvailableNotificationReferenceId, MarketOperator = marketOperator }; return(message.ToByteArray()); }
public void Parse_BytesValid_Returns_Valid_Object() { // arrange var target = new DequeueNotificationParser(); var validBytes = new DequeueContract { MarketOperator = "06FD1AB3-D650-45BC-860E-EE598A3623CA", DataAvailableNotificationReferenceId = "7946F84C-FE27-43F3-B3D4-EE59CBA2F82C" }.ToByteArray(); // act var actual = target.Parse(validBytes); // assert Assert.NotNull(actual); Assert.Equal(Guid.Parse("06FD1AB3-D650-45BC-860E-EE598A3623CA"), actual.MarketOperator.Value); Assert.Equal("7946F84C-FE27-43F3-B3D4-EE59CBA2F82C", actual.DataAvailableNotificationReferenceId); }
public Task SendAsync(string correlationId, DequeueNotificationDto dequeueNotificationDto, DomainOrigin domainOrigin) { ArgumentNullException.ThrowIfNull(dequeueNotificationDto, nameof(dequeueNotificationDto)); var queueName = GetQueueName(domainOrigin); var serviceBusSender = _messageBusFactory.GetSenderClient(queueName); #pragma warning disable CS0618 var marketOperator = dequeueNotificationDto.MarketOperator is LegacyActorIdDto legacyActorIdDto #pragma warning restore CS0618 ? legacyActorIdDto.LegacyValue : dequeueNotificationDto.MarketOperator.Value.ToString(); var contract = new DequeueContract { DataAvailableNotificationReferenceId = dequeueNotificationDto.DataAvailableNotificationReferenceId, MarketOperator = marketOperator }; var dequeueMessage = new ServiceBusMessage(new BinaryData(contract.ToByteArray())) .AddDequeueIntegrationEvents(correlationId); return(serviceBusSender.PublishMessageAsync <ServiceBusMessage>(dequeueMessage)); }