public async Task ShouldReplicate()
        {
            var replicaStateHandler   = new StateHolderEventHandler();
            var replicaCleanerHandler = new CleanerEventHandler();

            using (var replica = new FxPricingEngine(replicaStateHandler, replicaCleanerHandler))
            {
                var ioHandler         = new IOPersistanceEventHandler();
                var stateHandler      = new StateHolderEventHandler();
                var cleanerHandler    = new CleanerEventHandler();
                var replicatorHandler = new ReplicatorEventHandler(replica);

                using (var engine = new FxPricingEngine(ioHandler, replicatorHandler, stateHandler, cleanerHandler))
                {
                    using (var publisher = new FxPricePublisher(engine))
                    {
                        publisher.PublishOne();

                        await Task.Delay(100);

                        Assert.AreEqual(replicaStateHandler.State.Count, stateHandler.State.Count);
                    }
                }
            }
        }
        public async Task ShouldTestOneEventPublish()
        {
            var ioHandler      = new IOPersistanceEventHandler();
            var stateHandler   = new StateHolderEventHandler();
            var cleanerHandler = new CleanerEventHandler();

            using (var engine = new FxPricingEngine(ioHandler, stateHandler, cleanerHandler))
            {
                using (var publisher = new FxPricePublisher(engine))
                {
                    publisher.PublishOne();

                    await Task.Delay(100);

                    Assert.AreEqual(1, stateHandler.State.Count);
                    Assert.AreEqual(1, ioHandler.WriteCount);
                }
            }
        }
        public async Task ShouldTestBatchEventPublish()
        {
            var ioHandler      = new IOPersistanceEventHandler();
            var stateHandler   = new StateHolderEventHandler();
            var cleanerHandler = new CleanerEventHandler();

            using (var engine = new FxPricingEngine(ioHandler, stateHandler, cleanerHandler))
            {
                using (var publisher = new FxPricePublisher(engine))
                {
                    publisher.PublishBatch(20);

                    await Task.Delay(100);

                    Assert.Greater(stateHandler.State.Count, 0);
                    Assert.AreEqual(20, stateHandler.State.SelectMany(s => s.Value.GetAll()).Count());
                    Assert.AreEqual(20, ioHandler.WriteCount);
                }
            }
        }
        public async Task ShouldPublishLooootsOfEvents()
        {
            var ioHandler      = new IOPersistanceEventHandler();
            var stateHandler   = new StateHolderEventHandler();
            var cleanerHandler = new CleanerEventHandler();

            using (var engine = new FxPricingEngine(ioHandler, stateHandler, cleanerHandler))
            {
                using (var publisher = new FxPricePublisher(engine))
                {
                    publisher.StartGenerateEvents();

                    await Task.Delay(2000);

                    var count = stateHandler.State.SelectMany(m => m.Value.GetAll()).Count();

                    Assert.Greater(count, publisher.Cache.Count * 0.90);
                    Assert.Greater(ioHandler.WriteCount, publisher.Cache.Count * 0.90);
                }
            }
        }