public void ReturnFalseIfPassedForecastIsNull()
        {
            var relativeDay       = RelativeDay.NextDay;
            var timeSpan          = new TimeSpan(21, 30, 0);
            var referenceDateTime = new DateTime(2019, 07, 29, 18, 30, 34);

            var SpecificationUnderTest = new OpenWeatherTimeSpecification(relativeDay, timeSpan, referenceDateTime);

            Assert.False(SpecificationUnderTest.IsSatisfiedBy(null));
        }
        public void ReturnTrueIfTimeDifferenceMatchesLimitPositive()
        {
            var relativeDay       = RelativeDay.NextDay;
            var timeSpan          = new TimeSpan(22, 30, 0);
            var referenceDateTime = new DateTime(2019, 07, 29, 18, 30, 34);
            var testForecast      = GetTestForecast();

            var SpecificationUnderTest = new OpenWeatherTimeSpecification(relativeDay, timeSpan, referenceDateTime);

            Assert.True(SpecificationUnderTest.IsSatisfiedBy(testForecast));
        }
        public void ReturnFalseIfTimeDifferenceIsOutOfRange()
        {
            var relativeDay       = RelativeDay.NextDay;
            var timeSpan          = new TimeSpan(19, 30, 0);
            var referenceDateTime = new DateTime(2019, 07, 28, 18, 30, 34);
            var testForecast      = GetTestForecast();

            var SpecificationUnderTest = new OpenWeatherTimeSpecification(relativeDay, timeSpan, referenceDateTime);

            Assert.False(SpecificationUnderTest.IsSatisfiedBy(testForecast));
        }
        public void UseTimeZoneInfoFromTimeProviderDuringComparison()
        {
            // Azerbaijan Standard Time UTC+4
            var relativeDay         = RelativeDay.NextDay;
            var timeSpan            = new TimeSpan(1, 0, 0); // will be interpreted as time already shifted to timezone
            var referenceDateTime   = new DateTime(2019, 07, 30, 18, 30, 34);
            var desiredTimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Azerbaijan Standard Time");

            var testForecast = GetTestForecast();

            TimeZoneProvider.TimeZone = desiredTimeZoneInfo;
            var SpecificationUnderTest = new OpenWeatherTimeSpecification(relativeDay, timeSpan, referenceDateTime);

            Assert.True(SpecificationUnderTest.IsSatisfiedBy(testForecast));
        }