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

            return w;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        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);
                }
            }
        }