public void Should_NotNotifyNewOrders_When_NotStarted()
        {
            String order      = OrderHelper.GetOrderString(null, null, currentTime);
            var    isNotified = false;

            using (var reader = new StringReader(order))
            {
                orderStreamer = new OrderMockedTimeStreamer(reader, currentTime);

                orderStreamer.OnNewOrders(newOrder =>
                {
                    isNotified = true;
                });
            }

            Assert.False(isNotified);
        }
        public void Should_NotNotifyNewOrders_When_AddedTimeLessOrderCreated(int startHour, String order)
        {
            currentTime = new DateTime();
            currentTime.AddHours(startHour);

            using (var reader = new StringReader(order))
            {
                orderStreamer = new OrderMockedTimeStreamer(reader, currentTime);

                orderStreamer.Start();
                Order resultOrder = null;
                orderStreamer.OnNewOrders(newOrder =>
                {
                    resultOrder = newOrder;
                });
                orderStreamer.AddMinutesToTime(1);

                Assert.Null(resultOrder);
            }
        }
        public void Should_NotifyNewOrders_When_CurrentTimeCanBeAdvanced(params String[] orders)
        {
            currentTime = new DateTime(1, 1, 1, 1, 1, 1);
            using (var reader = new StringReader(String.Join("\n", orders)))
            {
                orderStreamer = new OrderMockedTimeStreamer(reader, currentTime);

                orderStreamer.Start();
                var orderIndex = 0;
                orderStreamer.OnNewOrders(newOrder =>
                {
                    Assert.Equal(orders[orderIndex], OrderHelper.GetOrderString(newOrder));
                    orderIndex++;
                });
                for (var i = 0; i < orders.Length; i++)
                {
                    orderStreamer.AdvanceTime();
                }

                Assert.Equal(orderIndex, orders.Length);
            }
        }