Inheritance: IWorkingDaysProvider
        public static WorkingDays Get(IWorkingDaysProvider key)
        {
            WorkingDays w = null;
            if (!instances.TryGetValue(key, out w))
                instances[key] = w = new WorkingDays(key);

            return w;
        }
Exemple #2
0
        public static WorkingDays Get(IWorkingDaysProvider key)
        {
            WorkingDays w = null;

            if (!instances.TryGetValue(key, out w))
            {
                instances[key] = w = new WorkingDays(key);
            }

            return(w);
        }
        protected static void AssertProviderHeavy(IWorkingDaysProvider prov, int iterations, bool forward, bool consider, params DateTime[] baseDates)
        {
            foreach (var baseDate in baseDates)
            {
                WorkingDays w = new WorkingDays(prov);

                int one = forward ? 1 : -1;

                DateTime curr = baseDate;
                for (int i = 1; i <= iterations; i++)
                {
                    while (!w.IsWorkingDay(curr) || (!consider && curr == baseDate))
                        curr = curr.AddDays(one);

                    if (forward)
                        w.GetInAdvance(i, baseDate, consider).Should().Be(curr);
                    else
                        w.GetBackwards(i, baseDate, consider).Should().Be(curr);

                    curr = curr.AddDays(one);
                }
            }
        }