private static void Main(string[] args) { var shoppy = new Shoppy(); shoppy.TestShoppy(); return; ; var stockTicker = new StockTicker(); var stockListner = new RxStockMonitor(stockTicker); ThreadPool.QueueUserWorkItem((_)=>stockTicker.Notify(new StockTick() { Price = 100, QuoteSymbol = "MSFT" })); ThreadPool.QueueUserWorkItem((_)=>stockTicker.Notify(new StockTick() { Price = 150, QuoteSymbol = "INTC" })); ThreadPool.QueueUserWorkItem((_)=>stockTicker.Notify(new StockTick() { Price = 170, QuoteSymbol = "MSFT" })); ThreadPool.QueueUserWorkItem((_)=>stockTicker.Notify(new StockTick() { Price = 195.5M, QuoteSymbol = "MSFT" })); while (true) { Console.Write("enter symbol: "); var symbol = Console.ReadLine(); if (symbol.ToLower() == "x") { break; } Console.WriteLine("enter value: "); var val = decimal.Parse(Console.ReadLine()); for (int i = 0; i < 30; i++) { int i1 = i; Task.Run(() => stockTicker.Notify(new StockTick() { Price = val, QuoteSymbol = symbol + i1 })); } } Console.WriteLine("Bye Bye"); }
private static void Main(string[] args) { var shoppy = new Shoppy(); shoppy.TestShoppy(); return; ; var stockTicker = new StockTicker(); var stockListner = new RxStockMonitor(stockTicker); ThreadPool.QueueUserWorkItem((_) => stockTicker.Notify(new StockTick() { Price = 100, QuoteSymbol = "MSFT" })); ThreadPool.QueueUserWorkItem((_) => stockTicker.Notify(new StockTick() { Price = 150, QuoteSymbol = "INTC" })); ThreadPool.QueueUserWorkItem((_) => stockTicker.Notify(new StockTick() { Price = 170, QuoteSymbol = "MSFT" })); ThreadPool.QueueUserWorkItem((_) => stockTicker.Notify(new StockTick() { Price = 195.5M, QuoteSymbol = "MSFT" })); while (true) { Console.Write("enter symbol: "); var symbol = Console.ReadLine(); if (symbol.ToLower() == "x") { break; } Console.WriteLine("enter value: "); var val = decimal.Parse(Console.ReadLine()); for (int i = 0; i < 30; i++) { int i1 = i; Task.Run(() => stockTicker.Notify(new StockTick() { Price = val, QuoteSymbol = symbol + i1 })); } } Console.WriteLine("Bye Bye"); }
public void Bla() { var stockTicks = new[] { new StockTick() {QuoteSymbol = "MSFT", Price = 53.49M}, new StockTick() {QuoteSymbol = "INTC", Price = 32.68M}, new StockTick() {QuoteSymbol = "ORCL", Price = 41.48M}, new StockTick() {QuoteSymbol = "CSCO", Price = 28.33M}, }.ToObservable().ToEvent(); var testScheduler = new TestScheduler(); var testableObserver = testScheduler.CreateObserver<DrasticChange>(); var stockTicker = A.Fake<IStockTicker>(); A.CallTo(()=>stockTicker.StockTick). var rxStockMonitor = new RxStockMonitor(stockTicker); rxStockMonitor.DrasticChanges.Subscribe(testableObserver); }
private static void Main(string[] args) { _stockTicker = new StockTicker(); ///////////////////////////////////////////////////////////// // // // 1. Uncomment the StockMonitor version you wish to test // // // ///////////////////////////////////////////////////////////// // Regular events StockMonitor //var stockMonitor = new StockMonitor(_stockTicker); // Rx StockMonitor - uses Rx to consume and process the stock ticks var stockMonitor = new RxStockMonitor(_stockTicker); ShowMenu(); GC.KeepAlive(stockMonitor); Console.WriteLine("Press <enter> to continue..."); Console.ReadLine(); Console.WriteLine("Bye Bye"); }
private static void Main(string[] args) { _stockTicker = new StockTicker(); ///////////////////////////////////////////////////////////// // // // 1. Uncomment the StockMonitor version you wish to test // // // ///////////////////////////////////////////////////////////// // Regular events StockMonitor //var stockMonitor = new StockMonitor(_stockTicker); // Rx StockMonitor - uses Rx to consume and process the stock ticks var stockMonitor = new RxStockMonitor(_stockTicker); ShowMenu(); GC.KeepAlive(stockMonitor); Console.WriteLine("Press <enter> to continue..."); Console.ReadLine(); Console.WriteLine("Bye Bye"); }