示例#1
0
        public void Ctor_NullFilters()
        {
            var unit = new RequestFilteringSampler(
                null,
                new MockSampler(),
                Mock.Of <IHttpContextAccessor>());

            unit.Should().NotBeNull("because we passed valid arguments");

            unit.SamplingFilters
            .Should().NotBeNull()
            .And.BeEmpty("because we did not supply any filters to the constructor");
        }
示例#2
0
        public void Ctor()
        {
            var unit = new RequestFilteringSampler(
                new[] { new MockSamplingFilter() },
                new MockSampler(),
                Mock.Of <IHttpContextAccessor>());

            unit.Should().NotBeNull("because we passed valid arguments");

            unit.SamplingFilters
            .Should().NotBeNull()
            .And.HaveCount(1);

            unit.DefaultSampler
            .Should().BeOfType <MockSampler>(
                "because we passed a MockSampler to the constructor");

            unit.HttpContextAccessor.HttpContext
            .Should().BeNull(
                "because the mock context accessor does not contain a HttpContext");
        }