예제 #1
0
        public void ShouldNotReturnValuesGiveInvalidExchangeCode()
        {
            var holidayByYearWebServiceGateway = new ExchangeHolidayWebServiceGateway();

            var result = holidayByYearWebServiceGateway.GetByYear("XXXX", 2010, 2014);

            result.ExchangeIsoCode.Should().Be("XXXX");
            result.StartYear.Should().Be(2010);
            result.EndYear.Should().Be(2014);
            result.HasError.Should().BeTrue();
            result.ErrorMessage.Should().Be("Exchange was not found.");
        }
예제 #2
0
        public void ShouldReturnValidHolidaysForSingleYear(
            string exchangeCode,
            int year)
        {
            var holidayByYearWebServiceGateway = new ExchangeHolidayWebServiceGateway();

            var result = holidayByYearWebServiceGateway.GetByYear(exchangeCode, year, year);

            result.ExchangeIsoCode.Should().Be(exchangeCode);
            result.StartYear.Should().Be(year);
            result.EndYear.Should().Be(year);
            result.HasError.Should().BeFalse();
            result.ErrorMessage.Should().BeNullOrEmpty();

            AssertCorrectHolidaysForYear(year, result.Holidays);
        }
예제 #3
0
        public void ShouldReturnValidHolidaysForManyYears(
            string exchangeCode,
            int startYear,
            int endYear)
        {
            var holidayByYearWebServiceGateway = new ExchangeHolidayWebServiceGateway();

            var result = holidayByYearWebServiceGateway.GetByYear(exchangeCode, startYear, endYear);

            result.ExchangeIsoCode.Should().Be(exchangeCode);
            result.StartYear.Should().Be(startYear);
            result.EndYear.Should().Be(endYear);
            result.HasError.Should().BeFalse();
            result.ErrorMessage.Should().BeNullOrEmpty();

            for (int yearCounter = startYear; yearCounter <= endYear; yearCounter++)
            {
                var holidaysForSingleYear = result.Holidays
                                            .Where(h => h.Year == yearCounter)
                                            .ToArray();

                AssertCorrectHolidaysForYear(yearCounter, holidaysForSingleYear);
            }
        }