public void DefaultBasicTracer_WhenFinishSpan_CallsRecorderWithAllSpanData() { var spanContextFactory = new OpenTracingSpanContextFactory(); var traceBuilder = new TracerBuilder <OpenTracingSpanContext>(); traceBuilder.SetSpanContextFactory(spanContextFactory); var simpleMockRecorder = new SimpleMockRecorder(); traceBuilder.SetSpanRecorder(simpleMockRecorder); var tracer = traceBuilder.BuildTracer(); var parentSpan = spanContextFactory.NewRootSpanContext(); var span = tracer.BuildSpan("TestOperation") .WithStartTime(DateTime.Parse("2016-01-01 12:00")) .WithTag("inittagkey", "InitTagValue") .AsChildOf(parentSpan) .Start(); span.SetBaggageItem("baggagekey", "BaggageValue"); span.SetTag("tagkey", "TagValue"); span.FinishWithOptions(new FinishSpanOptions(DateTime.Parse("2016-01-01 12:00") + TimeSpan.FromMinutes(1))); Assert.AreEqual("TestOperation", simpleMockRecorder.spanEvents.First().OperationName); Assert.AreEqual("InitTagValue", simpleMockRecorder.spanEvents.First().Tags["inittagkey"]); Assert.AreEqual(DateTime.Parse("2016-01-01 12:00"), simpleMockRecorder.spanEvents.First().StartTime); Assert.AreEqual(TimeSpan.FromMinutes(1), simpleMockRecorder.spanEvents.First().Duration); Assert.AreEqual("BaggageValue", simpleMockRecorder.spanEvents.First().Context.Baggage["baggagekey"]); Assert.AreEqual("TagValue", simpleMockRecorder.spanEvents.First().Tags["tagkey"]); Assert.AreEqual(0, simpleMockRecorder.spanEvents.First().Context.ParentId); Assert.AreNotEqual(0, simpleMockRecorder.spanEvents.First().Context.TraceId); Assert.AreNotEqual(0, simpleMockRecorder.spanEvents.First().Context.SpanId); Assert.AreEqual(SpanReferenceType.ChildOfRef, simpleMockRecorder.spanEvents.First().References.First().Type); Assert.AreEqual(parentSpan, simpleMockRecorder.spanEvents.First().References.First().ReferencedContext); }