public void ConvertNanoTime()
        {
            mockClock.Setup(clock => clock.Now).Returns(timestamp);
            mockClock.Setup(clock => clock.NowNanos).Returns(1234L);

            ITimestampConverter timeConverter = TimestampConverter.Now(mockClock.Object);

            Assert.Equal(Timestamp.Create(1234, 10678), timeConverter.ConvertNanoTime(6234));
            Assert.Equal(Timestamp.Create(1234, 5444), timeConverter.ConvertNanoTime(1000));
            Assert.Equal(Timestamp.Create(1235, 0), timeConverter.ConvertNanoTime(999995556));
        }
예제 #2
0
        //@Rule public readonly ExpectedException exception = ExpectedException.none();


        public SpanTest()
        {
            spanContext        = SpanContext.Create(TraceId.GenerateRandomId(random), SpanId.GenerateRandomId(random), TraceOptions.DEFAULT);
            parentSpanId       = SpanId.GenerateRandomId(random);
            testClock          = TestClock.Create(timestamp);
            timestampConverter = TimestampConverter.Now(testClock);
            attributes.Add(
                "MyStringAttributeKey", AttributeValue.StringAttributeValue("MyStringAttributeValue"));
            attributes.Add("MyLongAttributeKey", AttributeValue.LongAttributeValue(123L));
            attributes.Add("MyBooleanAttributeKey", AttributeValue.BooleanAttributeValue(false));
            expectedAttributes = new Dictionary <String, IAttributeValue>(attributes);
            expectedAttributes.Add(
                "MySingleStringAttributeKey",
                AttributeValue.StringAttributeValue("MySingleStringAttributeValue"));
        }