Example #1
0
        public void ConfigureHttp()
        {
            var valuesFalse = new PerformanceConfiguration
            {
                DefaultConnectionLimit = 26,
                UseNagle          = false,
                Expect100Continue = false
            };
            var valuesTrue = new PerformanceConfiguration
            {
                DefaultConnectionLimit = 37,
                UseNagle          = true,
                Expect100Continue = true
            };


            PerformanceManager.ConfigureHttp(valuesFalse);

            var falseConnectionLimit = ServicePointManager.DefaultConnectionLimit;
            var falseUseNagle        = ServicePointManager.UseNagleAlgorithm;
            var falseExpect100       = ServicePointManager.Expect100Continue;

            PerformanceManager.ConfigureHttp(valuesTrue);

            var trueConnectionLimit = ServicePointManager.DefaultConnectionLimit;
            var trueUseNagle        = ServicePointManager.UseNagleAlgorithm;
            var trueExpect100       = ServicePointManager.Expect100Continue;

            Assert.IsFalse(falseUseNagle, "False use nagle not expected");
            Assert.IsFalse(falseExpect100, "False not expected not expected");
            Assert.IsTrue(falseConnectionLimit == 26, "False connection limit not expected");

            Assert.IsTrue(trueUseNagle, "True use nagle not expected");
            Assert.IsTrue(trueExpect100, "True not expected not expected");
            Assert.IsTrue(trueConnectionLimit == 37, "True connection limit not expected");
        }