public static Trader Instance() { if (_instance == null) { var stockApiService = StockAPIService.Instance(); _instance = new Trader(stockApiService); } return(_instance); }
[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")); }