public void ThrottledMarketDataStreamTasksMultithreadingOnUpdateSecondTest()
        {
            var stream = new ThrottledMarketDataStream();

            var randomizer = new Random(new Random().Next(1, int.MaxValue));
            var tasks      = new List <Task>();
            List <MarketDataUpdate> list = new List <MarketDataUpdate>();

            for (int i = 0; i < 1000; i++)
            {
                var update = new MarketDataUpdate()
                {
                    InstrumentId = "AAPL_" + randomizer.Next(1, 100),
                    Fields       = new Dictionary <byte, long>(),
                };

                for (int j = 0; j < randomizer.Next(1, 5); j++)
                {
                    update.Fields[(byte)randomizer.Next(1, 20)] = randomizer.Next(1, 10000);
                }
                list.Add(update);
            }

            for (int i = 0; i < list.Count - 1; i++)
            {
                tasks.Add(new Task(() => stream.OnUpdate(list[i])));
            }

            Parallel.ForEach(tasks, task =>
            {
                task.Start();
            });

            Task.WhenAll(tasks).ContinueWith(done =>
            {
                // this will not print untill all tasks have completed.
                System.Diagnostics.Debug.WriteLine("All tasks OnUpdate finished.");
            });
        }
        public void ThrottledMarketDataStreamOnUpdateNullIgnore()
        {
            var stream = new ThrottledMarketDataStream();

            stream.OnUpdate(null);
        }