public async void GetNonTradingDays(int year, int expectedCount)
        {
            var mockRepository = new MockRepository(MockBehavior.Strict);

            HttpRequestMessage requestMessage = null;
            var fileName       = String.Format("asx-trading-calendar-{0}.htm", year);
            var messageHandler = mockRepository.CreateFileContentMessageHandler(fileName, "text/html", x => requestMessage = x);

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

            var result = await dataService.GetNonTradingDays(year, CancellationToken.None);

            requestMessage.Method.Should().Be(HttpMethod.Get);
            requestMessage.RequestUri.AbsoluteUri.Should().Be("http://www.asx.com.au/about/" + fileName);
            result.Should().HaveCount(expectedCount);

            var newYearsDay = new Date(year, 01, 01);

            while (!newYearsDay.WeekDay())
            {
                newYearsDay = newYearsDay.AddDays(1);
            }

            result.First().Should().BeEquivalentTo(new NonTradingDay(newYearsDay, "New Year's Day"));
        }
        public async void GetNonTradingDaysHttpError()
        {
            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.GetNonTradingDays(2020, CancellationToken.None);

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

            var json = "{ \"Meta Data2\": " +
                       "   { \"1. Information\": \"Daily Prices (open, high, low, close) and Volumes\"," +
                       "     \"2. Symbol\": \"IBM\"," +
                       "     \"3. Last Refreshed\": \"2020-05-15\"," +
                       "     \"4. Output Size\": \"Compact\"," +
                       "     \"5. Time Zone\": \"US/Eastern\"" +
                       "   }" +
                       "}";

            var messageHandler = mockRepository.CreateJsonMessageHandler(json);

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

            var result = await dataService.GetNonTradingDays(2020, CancellationToken.None);

            result.Should().BeEmpty();
        }