示例#1
0
 public static Trader Instance()
 {
     if (_instance == null)
     {
         var stockApiService = StockAPIService.Instance();
         _instance = new Trader(stockApiService);
     }
     return(_instance);
 }
示例#2
0
        [Test] // readFromURL returned wrong JSON
        public void TestGetPriceMalformedResponse()
        {
            //arrange
            var stockApi = StockAPIService.Instance();
            var dummy    = "dummy";

            //act

            _reader.ReadFromUrl(dummy).Throws(new Newtonsoft.Json.JsonReaderException());
            stockApi.Reader  = _reader;
            stockApi.APIPath = dummy;

            //assert
            Assert.Throws <Newtonsoft.Json.JsonReaderException>(() => stockApi.GetPrice("aapl"));
        }