Example #1
0
        public void BuilderIsCorrect()
        {
            // Arrange
            var expectedBuilder = new DelegatingSpecimenBuilder();
            var sut             = new TracingBuilder(expectedBuilder);
            // Act
            ISpecimenBuilder result = sut.Builder;

            // Assert
            Assert.Equal(expectedBuilder, result);
        }
Example #2
0
        public void TracerIsCorrect()
        {
            // Arrange
            var dummyWriter    = TextWriter.Null;
            var expectedTracer = new DelegatingTracingBuilder();
            var sut            = new TraceWriter(dummyWriter, expectedTracer);
            // Act
            TracingBuilder result = sut.Tracer;

            // Assert
            Assert.Equal(expectedTracer, result);
        }
Example #3
0
        public void BuilderIsCorrect()
        {
            // Fixture setup
            var expectedBuilder = new DelegatingSpecimenBuilder();
            var sut             = new TracingBuilder(expectedBuilder);
            // Exercise system
            ISpecimenBuilder result = sut.Builder;

            // Verify outcome
            Assert.Equal(expectedBuilder, result);
            // Teardown
        }
Example #4
0
        public void TracerIsCorrect()
        {
            // Fixture setup
            var dummyWriter    = TextWriter.Null;
            var expectedTracer = new DelegatingTracingBuilder();
            var sut            = new TraceWriter(dummyWriter, expectedTracer);
            // Exercise system
            TracingBuilder result = sut.Tracer;

            // Verify outcome
            Assert.Equal(expectedTracer, result);
            // Teardown
        }
Example #5
0
        public static void Main(string[] args)
        {
            //Jaeger.TraceId traceId = Jaeger.TraceId.FromString("658b079af1589b5b");
            //var tmp = traceId.ToByteArray();
            //ByteString tmptmp = Google.Protobuf.ByteString.CopyFrom(tmp);

            //var str = TracingUntil.ByteStringToString(tmptmp);

            TracingBuilder tracingBuilder = new TracingBuilder();

            tracingBuilder.WithDataName("test")
            .WithDocument("test");
            CreateHostBuilder(args).Build().Run();
        }
Example #6
0
        public void CreateWillReturnCorrectResult()
        {
            // Arrange
            var expectedSpecimen = new object();
            var stubBuilder      = new TracingBuilder(new DelegatingSpecimenBuilder {
                OnCreate = (r, c) => expectedSpecimen
            });

            var dummyWriter = TextWriter.Null;
            var sut         = new TraceWriter(dummyWriter, stubBuilder);
            // Act
            var dummyRequest   = new object();
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(dummyRequest, dummyContainer);

            // Assert
            Assert.Equal(expectedSpecimen, result);
        }
Example #7
0
        public void CreateWillInvokeDecoratedBuilderWithCorrectParameters()
        {
            // Arrange
            var expectedRequest   = new object();
            var expectedContainer = new DelegatingSpecimenContext();

            var verified    = false;
            var mockBuilder = new TracingBuilder(new DelegatingSpecimenBuilder {
                OnCreate = (r, c) => verified = expectedRequest == r && expectedContainer == c
            });

            var dummyWriter = TextWriter.Null;
            var sut         = new TraceWriter(dummyWriter, mockBuilder);

            // Act
            sut.Create(expectedRequest, expectedContainer);
            // Assert
            Assert.True(verified, "Mock verified");
        }
        public void CreateWillReturnCorrectResult()
        {
            // Fixture setup
            var expectedSpecimen = new object();
            var stubBuilder      = new TracingBuilder(new DelegatingSpecimenBuilder
            {
                OnCreate = (r, c) => expectedSpecimen
            });

            var sut = new TerminatingWithPathSpecimenBuilder(stubBuilder);
            // Exercise system
            var dummyRequest   = new object();
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(dummyRequest, dummyContainer);

            // Verify outcome
            Assert.Equal(expectedSpecimen, result);
            // Teardown
        }
        public void CreateWillInvokeDecoratedBuilderWithCorrectParameters()
        {
            // Fixture setup
            var expectedRequest   = new object();
            var expectedContainer = new DelegatingSpecimenContext();

            var verified    = false;
            var mockBuilder = new TracingBuilder(new DelegatingSpecimenBuilder
            {
                OnCreate = (r, c) => verified = expectedRequest == r && expectedContainer == c
            });

            var sut = new TerminatingWithPathSpecimenBuilder(mockBuilder);

            // Exercise system
            sut.Create(expectedRequest, expectedContainer);
            // Verify outcome
            Assert.True(verified, "Mock verified");
            // Teardown
        }