public void GetTransactionId_WithoutTransactionIdAsUserProperty_ReturnsEmptyString() { // Arrange ServiceBusReceivedMessage message = CreateMessage(key: null, value: null); // Act string transactionId = message.GetTransactionId(); // Assert Assert.Null(transactionId); }
public void GetTransactionId_WithTransactionIdAsUserProperty_ReturnsCorrectTransactionId() { // Arrange var expectedTransactionId = $"transaction-{Guid.NewGuid()}"; ServiceBusReceivedMessage message = CreateMessage(PropertyNames.TransactionId, expectedTransactionId); // Act string transactionId = message.GetTransactionId(); // Assert Assert.NotNull(transactionId); Assert.Equal(expectedTransactionId, transactionId); }
public void GetTransactionId_WithTransactionIdInCustomUserProperty_ReturnsCorrectTransactionId() { // Arrange var expectedTransactionId = $"transaction-{Guid.NewGuid()}"; const string transactionIdPropertyName = "Correlation-Transaction-Id"; ServiceBusReceivedMessage message = CreateMessage(transactionIdPropertyName, expectedTransactionId); // Act string transactionId = message.GetTransactionId(transactionIdPropertyName: transactionIdPropertyName); // Assert Assert.NotNull(transactionId); Assert.Equal(expectedTransactionId, transactionId); }