Example #1
0
        public bool TestAndCompare2(StoreToWorld storeworld, int year)
        {
            bool equal = true;

#if DEBUG
            DateTime begin       = DateTimeHelper.GetBeginYearDate(year);
            DateTime end         = DateTimeHelper.GetEndYearDate(year);
            int      count_weeks = DateTimeHelper.GetCountWeekInYear(year);

            int[] sums  = new int[count_weeks];
            int[] sums2 = new int[count_weeks];

            DateTime date = begin;

            EstimatedWorldHoursBuilder  b  = new EstimatedWorldHoursBuilder();
            EstimatedWorldHoursBuilder2 b2 = new EstimatedWorldHoursBuilder2();
            for (int i = 0; i < count_weeks; i++)
            {
                sums[i]  = b.Build(storeworld, date, DateTimeHelper.GetSunday(date));
                sums2[i] = b2.Build(storeworld, date, DateTimeHelper.GetSunday(date));

                date = DateTimeHelper.GetNextMonday(date);
            }
            int[] sums3 = BuildYear(storeworld, year);

            for (int i = 0; i < count_weeks; i++)
            {
                Debug.WriteLine(sums[i].ToString() + " ----------------- " + sums2[i] + " ----- " + sums[i]);

                Debug.Assert(sums[i] == sums2[i]);
                Debug.Assert(sums[i] == sums3[i]);
                Debug.Assert(sums2[i] == sums3[i]);
                equal &= (sums[i] == sums2[i]) & (sums2[i] == sums3 [i]);
            }
#endif
            return(equal);
        }
        public bool TestAndCompare2(StoreToWorld storeworld, int year)
        {
            bool equal = true;

            #if DEBUG
            DateTime begin = DateTimeHelper.GetBeginYearDate(year);
            DateTime end = DateTimeHelper.GetEndYearDate(year);
            int count_weeks = DateTimeHelper.GetCountWeekInYear(year);

            int[] sums = new int[count_weeks];
            int[] sums2 = new int[count_weeks];

            DateTime date = begin;

            EstimatedWorldHoursBuilder b = new EstimatedWorldHoursBuilder();
            EstimatedWorldHoursBuilder2 b2 = new EstimatedWorldHoursBuilder2();
            for (int i = 0; i < count_weeks; i++)
            {
                sums[i] = b.Build(storeworld, date, DateTimeHelper.GetSunday(date));
                sums2[i] = b2.Build(storeworld, date, DateTimeHelper.GetSunday(date));

                date = DateTimeHelper.GetNextMonday(date);
            }
            int[] sums3 = BuildYear(storeworld, year);

            for (int i = 0; i < count_weeks; i++)
            {
                Debug.WriteLine(sums[i].ToString() + " ----------------- " + sums2[i] + " ----- " + sums[i]);

                Debug.Assert(sums[i] == sums2[i]);
                Debug.Assert(sums[i] == sums3[i]);
                Debug.Assert(sums2[i] == sums3[i]);
                equal &= (sums[i] == sums2[i]) & (sums2[i] == sums3 [i]);
            }

            #endif
            return equal;
        }