Click here to Skip to main content
15,881,248 members
Articles / Programming Languages / C# 4.0

WCF Proxy Manager - Going Configless

Rate me:
Please Sign up or sign in to vote.
4.80/5 (8 votes)
17 Apr 2012CPOL5 min read 99.8K   601   36  
Making WCF Config Lite, easy for developers, and durable ... yup durable without ping.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using HelloWorldServiceProxies;

namespace TestHarness
{
    class Program
    {
        static void Main(string[] args)
        {
            runOptions();
        }

        private static void runOptions()
        {
            Console.Clear();
            Console.WriteLine("PROXY MANAGER TEST HARNESS");
            Console.WriteLine("Press <R> to Run test any other key to exit:");
            var s = Console.ReadKey();
            
            if (s.Key == ConsoleKey.R) {runTest();}
        }

        private static void runTest()
        {
            Console.Clear();
            var sw = new Stopwatch();
            var sw2 = new Stopwatch();
            var avgTimes = new List<int>();
            sw2.Start();
            for (var i = 1; i < 1001; i++)
            {
                sw.Start();
                var helloReturn = Proxies.HelloWorldService.Hello();
                var s = Proxies.GoodByeWorldService.GoodBye();

                sw.Stop();
                avgTimes.Add(sw.Elapsed.Milliseconds);
                sw.Reset();
            }
            sw2.Stop();
            var avg = avgTimes.Average();


            Console.WriteLine("The Average NEW Service call in mil:" + avg);
            Console.WriteLine("total test Time:" + sw2.ElapsedMilliseconds);
            Console.WriteLine("Press Any Key to continue");
            Console.ReadKey();
            runOptions();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect ESPN
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions