public async Task StartAsync_CreateCustomExtension_ExtensionIsPassedThrough() { var consumer = new InMemoryConsumer <string>(); var publisher = new InMemoryPublisher <string>(); using var host = GetReverseStringService(consumer, publisher); await host.StartAsync(); var motorCloudEvent = MotorCloudEvent.CreateTestCloudEvent(Array.Empty <byte>()); motorCloudEvent.SetSomeCustomExtension(DateTimeOffset.MaxValue); await consumer.AddMessage(motorCloudEvent); var receivedCloudEvent = publisher.Events.First(); Assert.Equal(DateTimeOffset.MaxValue, receivedCloudEvent.GetSomeCustomExtension()); await host.StopAsync(); }
public async Task StartAsync_CreateSpanAsReference_ContextIsReferenced() { var consumer = new InMemoryConsumer <string>(); var publisher = new InMemoryPublisher <string>(); using var host = GetReverseStringService(consumer, publisher); await host.StartAsync(); var randomActivity = CreateRandomActivity(); var motorCloudEvent = MotorCloudEvent.CreateTestCloudEvent(Array.Empty <byte>()); motorCloudEvent.SetActivity(randomActivity); await consumer.AddMessage(motorCloudEvent); var ctx = publisher.Events.First().GetActivityContext(); Assert.Equal(randomActivity.Context.TraceId, ctx.TraceId); Assert.NotEqual(randomActivity.Context.SpanId, ctx.SpanId); await host.StopAsync(); }