private W3CTracestate(List <string> vendorstates, string accountKey, int version, int parentType, string accountId, string appId, string spanId, string transactionId, int?sampled, float?priority, long timestamp, IngestErrorType error) { VendorstateEntries = vendorstates; AccountKey = accountKey; Version = version; ParentType = (DistributedTracingParentType)parentType; AccountId = accountId; AppId = appId; SpanId = spanId; TransactionId = transactionId; Sampled = sampled; Priority = priority; Timestamp = timestamp; Error = error; }
public void GetW3CTracestateFromHeaders_NewRelicTracestateEntry_Tests(string headerString, string trustedAccountKey, string expectedOtherVendors, int?expectedSampled, float?expectedPriority, IngestErrorType expectedIngestError) { var testHeaders = new List <string>() { headerString }; var tracestate = W3CTracestate.GetW3CTracestateFromHeaders(testHeaders, trustedAccountKey); if (expectedIngestError == IngestErrorType.None) { Assert.That(tracestate, Is.Not.Null); } else if (expectedOtherVendors != null) { Assert.That(tracestate.VendorstateEntries.Count > 0); Assert.AreEqual(expectedOtherVendors, string.Join(",", tracestate.VendorstateEntries)); } Assert.That(tracestate.Priority == expectedPriority, $@"Expects Priority {expectedPriority} but gets Priority {tracestate.Priority } instead."); Assert.That(tracestate.Sampled == expectedSampled, $@"Expects Sampled {expectedSampled} but gets Sampled {tracestate.Sampled } instead."); Assert.That(expectedIngestError == tracestate.Error, $@"Expects Error {expectedIngestError} but gets Error {tracestate.Error } instead."); }