Ejemplo n.º 1
0
        public FakeStockSchedule(bool isStockOpen, TimeSpan dueTime)
        {
            this.isStockOpen = isStockOpen;
            if (!isStockOpen)
            {
                var timer = new Timer((obj) =>
                {
                    this.isStockOpen = true;
                    StockExchangedOpened?.Invoke(this, null);
                }, null, Timeout.Infinite, Timeout.Infinite);

                timer.Change((int)dueTime.TotalMilliseconds, Timeout.Infinite);
            }
        }
Ejemplo n.º 2
0
 private void OnStockExchangedOpened(object state)
 {
     StockExchangedOpened?.Invoke(this, null);
     Thread.Sleep(1);
     CheckForOpeningOfStockExchange();
 }