Example #1
0
 public void Run()
 {
     var handlersLookup = new HandlersLookup();
     var disaptcher     = new Dispatcher(handlersLookup);
     var number         = disaptcher.Dispatch(new GetRandomNumberQuery(1, 100));
     var result         = disaptcher.Dispatch(new WriteNumberToConsoleCommand(number));
 }
        public void Run()
        {
            var initialization = Stopwatch.StartNew();
            var handlersLookup = new HandlersLookup();
            var disaptcher     = new Dispatcher(handlersLookup);

            initialization.Stop();

            var dispatch = Stopwatch.StartNew();
            var result   = disaptcher.Dispatch(new Command1000());

            dispatch.Stop();

            Console.WriteLine($"Initialization time: {initialization.ElapsedMilliseconds}ms.");
            Console.WriteLine($"Dispatch time: {dispatch.ElapsedMilliseconds}ms.");
        }