public void CurrentDateTimeNotWithinStartDateAndEndDate_IsNotInWindow()
        {
            var startDate = new DateTime(2016, 04, 01, 0, 0, 0);
            var endDate = new DateTime(2016, 07, 01, 0, 0, 0);
            var currentDate = new DateTime(2016, 03, 02, 0, 0, 0);

            var quarterWindow = new QuarterWindow(startDate, endDate);

            var result = quarterWindow.IsInWindow(currentDate);

            Assert.False(result);
        }
Esempio n. 2
0
        public void CurrentDateTimeNotWithinStartDateAndEndDate_IsNotInWindow()
        {
            var startDate   = new DateTime(2016, 04, 01, 0, 0, 0);
            var endDate     = new DateTime(2016, 07, 01, 0, 0, 0);
            var currentDate = new DateTime(2016, 03, 02, 0, 0, 0);

            var quarterWindow = new QuarterWindow(startDate, endDate, QuarterType.Q1);

            var result = quarterWindow.IsInWindow(currentDate);

            Assert.False(result);
        }
        public async Task<List<QuarterWindow>> GetQuarterWindowsForDate(DateTime date)
        {
            var possibleComplianceYears = new int[] { date.Year - 1, date.Year, date.Year + 1 };
            var possibleQuarterWindows = new List<QuarterWindow>();

            var allQuarterWindowTemplates = await dataAccess.GetAll();

            foreach (var possibleComplianceYear in possibleComplianceYears)
            {
                foreach (var item in allQuarterWindowTemplates)
                {
                    var startDate = new DateTime(possibleComplianceYear + item.AddStartYears, item.StartMonth, item.StartDay);
                    var endDate = new DateTime(possibleComplianceYear + item.AddEndYears, item.EndMonth, item.EndDay);

                    var quarterWindow = new QuarterWindow(startDate, endDate);

                    if (quarterWindow.IsInWindow(date))
                    {
                        possibleQuarterWindows.Add(new QuarterWindow(startDate, endDate));
                    }
                }
            }
            return possibleQuarterWindows;
        }
Esempio n. 4
0
        public async Task <List <QuarterWindow> > GetQuarterWindowsForDate(DateTime date)
        {
            var possibleComplianceYears = new int[] { date.Year - 1, date.Year, date.Year + 1 };
            var possibleQuarterWindows  = new List <QuarterWindow>();

            var allQuarterWindowTemplates = await dataAccess.GetAll();

            foreach (var possibleComplianceYear in possibleComplianceYears)
            {
                foreach (var item in allQuarterWindowTemplates)
                {
                    var startDate = new DateTime(possibleComplianceYear + item.AddStartYears, item.StartMonth, item.StartDay);
                    var endDate   = new DateTime(possibleComplianceYear + item.AddEndYears, item.EndMonth, item.EndDay);

                    var quarterWindow = new QuarterWindow(startDate, endDate, (QuarterType)item.Quarter);

                    if (quarterWindow.IsInWindow(date))
                    {
                        possibleQuarterWindows.Add(new QuarterWindow(startDate, endDate, (QuarterType)item.Quarter));
                    }
                }
            }
            return(possibleQuarterWindows);
        }