public async void GetSinglePriceHttpError()
        {
            var mockRepository = new MockRepository(MockBehavior.Strict);

            var messageHandler = mockRepository.CreateHttpStatusMessageHandler(HttpStatusCode.NotFound);

            var httpClient  = new HttpClient(messageHandler.Object);
            var dataService = new AsxDataService(httpClient);

            var result = await dataService.GetSinglePrice("IBM", CancellationToken.None);

            result.Should().BeNull();
        }
        public async void GetSinglePriceInvalidJson()
        {
            var mockRepository = new MockRepository(MockBehavior.Strict);

            var json = "xxxxx";

            var messageHandler = mockRepository.CreateJsonMessageHandler(json);

            var httpClient  = new HttpClient(messageHandler.Object);
            var dataService = new AsxDataService(httpClient);

            var result = await dataService.GetSinglePrice("IBM", CancellationToken.None);

            result.Should().BeNull();
        }
        public async void GetSinglePrice()
        {
            var mockRepository = new MockRepository(MockBehavior.Strict);

            var json = "{\"code\":\"BHP\",\"isin_code\":\"AU000000BHP4\",\"desc_full\":\"Ordinary Fully Paid\",\"last_price\":34.72,\"open_price\":34.38,\"day_high_price\":34.88,\"day_low_price\":34.25,\"change_price\":-0.33,\"change_in_percent\":\" - 0.942 % \",\"volume\":6214544,\"bid_price\":34.72,\"offer_price\":34.74,\"previous_close_price\":35.05,\"previous_day_percentage_change\":\"5.891 % \",\"year_high_price\":42.33,\"last_trade_date\":\"2020-05-20T00:00:00+1000\",\"year_high_date\":\"2019-07-03T00:00:00+1000\",\"year_low_price\":24.05,\"year_low_date\":\"2020-03-13T00:00:00+1100\",\"year_open_price\":39.1,\"year_open_date\":\"2014-02-25T11:00:00+1100\",\"year_change_price\":-4.38,\"year_change_in_percentage\":\"-11.202 % \",\"pe\":13.2,\"eps\":2.6547,\"average_daily_volume\":11644628,\"annual_dividend_yield\":6.08,\"market_cap\":103252091430,\"number_of_shares\":2945851396,\"deprecated_market_cap\":102279960000,\"deprecated_number_of_shares\":2945851394,\"suspended\":false}";

            HttpRequestMessage requestMessage = null;
            var messageHandler = mockRepository.CreateJsonMessageHandler(json, x => requestMessage = x);

            var httpClient  = new HttpClient(messageHandler.Object);
            var dataService = new AsxDataService(httpClient);

            var result = await dataService.GetSinglePrice("BHP", CancellationToken.None);

            requestMessage.Method.Should().Be(HttpMethod.Get);
            requestMessage.RequestUri.AbsoluteUri.Should().Be("https://www.asx.com.au/asx/1/share/BHP");
            result.Should().BeEquivalentTo(new StockPrice("BHP", new Date(2020, 05, 20), 34.72m));
        }