public void AddPerCallPolicy()
        {
            var options     = new ArmClientOptions();
            var dummyPolicy = new DummyPolicy();

            options.AddPolicy(dummyPolicy, HttpPipelinePosition.PerCall);
            var pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(new MockCredential(), "http://foo.com/.default"));

            var perCallPolicyField = pipeline.GetType().GetField("_pipeline", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField);
            var policies           = (ReadOnlyMemory <HttpPipelinePolicy>)perCallPolicyField.GetValue(pipeline);

            Assert.IsNotNull(policies.ToArray().FirstOrDefault(p => p.GetType() == typeof(DummyPolicy)));
        }
        public void AddPerCallPolicyViaClient()
        {
            var options     = InstrumentClientOptions(new ArmClientOptions());
            var dummyPolicy = new DummyPolicy();

            options.AddPolicy(dummyPolicy, HttpPipelinePosition.PerCall);
            var client = InstrumentClient(new ArmClient(TestEnvironment.Credential, options));

            var pipelineProperty = client.GetType().GetProperty("Pipeline", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty);
            var pipeline         = pipelineProperty.GetValue(client) as HttpPipeline;

            var perCallPolicyField = pipeline.GetType().GetField("_pipeline", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField);
            var policies           = (ReadOnlyMemory <HttpPipelinePolicy>)perCallPolicyField.GetValue(pipeline);

            Assert.IsNotNull(policies.ToArray().FirstOrDefault(p => p.GetType() == typeof(DummyPolicy)));
        }