public void TestAverageResponseTimeWhithMultipleRequests()
        {
            const int count = 1000;
            const int median1 = 100;
            const int median2 = 250;
            const int median3 = 500;
            const string request1 = "/Test.hml";
            const string request2 = "/Test/Request.aspx";
            const string request3 = "/Test2/Page.aspx";
            var testResults = new TestResultsBuilder().AddSamples(request1, count, median1)
                .AddSamples(request2, count, median2)
                .AddSamples(request3, count, median3)
                .Build();

            var processor = new TestResultsProcessor(testResults);
            processor.CreateDataResults();
            var result1 =
                processor.DataResults.AsQueryable().SingleOrDefault(x => x.Request == request1).AverageResponseTime;
            Assert.That(result1 == median1, "Expected: {0}, but was {1}", median1, result1);
            var result2 =
               processor.DataResults.AsQueryable().SingleOrDefault(x => x.Request == request2).AverageResponseTime;
            Assert.That(result2 == median2, "Expected: {0}, but was {1}", median2, result2);
            var result3 =
               processor.DataResults.AsQueryable().SingleOrDefault(x => x.Request == request3).AverageResponseTime;
            Assert.That(result3 == median3, "Expected: {0}, but was {1}", median3, result3);
        }
        public void TestAverageResponseTime()
        {
            const int count = 1000;
            const int median = 500;
            const string request = "/Test.hml";
            var testResults = new TestResultsBuilder().AddSamples(request, count, median).Build();

            var processor = new TestResultsProcessor(testResults);
            processor.CreateDataResults();
            var result =
                processor.DataResults.AsQueryable().SingleOrDefault(x => x.Request == request).AverageResponseTime;
            Assert.That(result == median, "Expected: {0}, but was {1}", median, result);
        }
        public void TestMaxResponseTime()
        {
            const int count = 1000;
            const int maxValue = 800;
            const string request = "/Test.hml";
            var testResults = new TestResultsBuilder().AddSamples(request, count, maxValue / 2, maxValue).Build();
            testResults.httpSample.Add(new testResultsHttpSample { t = maxValue, lb = request, ts = 1321978933941 });

            var processor = new TestResultsProcessor(testResults);
            processor.CreateDataResults();
            var result =
                processor.DataResults.AsQueryable().SingleOrDefault(x => x.Request == request).MaxResponseTime;
            Assert.That(result == maxValue, "Expected: {0}, but was {1}", maxValue, result);
        }
        public void TestPerformanceCreateDataResults()
        {
            const string request1 = "/Test.hml";
            const string request2 = "/Test/Request.aspx";
            const string request3 = "/Test2/Page.aspx";
            const int count = 10000;
            const int median1 = 100;
            const int median2 = 250;
            const int median3 = 500;
            var testResults = new TestResultsBuilder().AddSamples(request1, count, median1)
                 .AddSamples(request2, count, median2)
                 .AddSamples(request3, count, median3)
                 .Build();

            var sw = new Stopwatch();
            var processor = new TestResultsProcessor(testResults);
            sw.Start();
            processor.CreateDataResults();
            sw.Stop();
            Console.WriteLine("CreateDataResults - Ellapsed: " + sw.ElapsedMilliseconds);
        }