public void InjectIntegerAttribute() { var sut = new StringStream(XDocument.Parse("<root />").ToString(SaveOptions.DisableFormatting)); var stream = sut.InjectAttribute(BtsProperties.RetryCount, 13); stream.ReadToEnd().Should().Be("<root RetryCount=\"13\" />"); }
public void InjectStringAttribute() { var sut = new StringStream(XDocument.Parse("<root />").ToString(SaveOptions.DisableFormatting)); var stream = sut.InjectAttribute(SBMessagingProperties.CorrelationId, "correlationId"); stream.ReadToEnd().Should().Be("<root CorrelationId=\"correlationId\" />"); }
public void InjectDateTimeOffsetAttribute() { var sut = new StringStream(XDocument.Parse("<root />").ToString(SaveOptions.DisableFormatting)); var stream = sut.InjectAttribute(SBMessagingProperties.EnqueuedTimeUtc, DateTimeOffset.Parse("2022-02-24T11:00:00.123456+01:00", null, DateTimeStyles.RoundtripKind)); stream.ReadToEnd().Should().Be("<root EnqueuedTimeUtc=\"2022-02-24T11:00:00.123456+01:00\" />"); }