コード例 #1
0
        public static object[][] GetDateNotMatchingFilterTestParams()
        {
            var today     = SystemClock.Instance.Today();
            var yesterday = today.PlusDays(-1);
            var tomorrow  = today.PlusDays(1);

            return(new[]
            {
                // M. EXACT MATCH TESTS
                // M1. NOT specifying period param in query

                new object[] { DateFilter.Default("~M1.1", yesterday, null, today) },
                new object[] { DateFilter.Default("~M1.2", yesterday, today, yesterday, tomorrow) },
                new object[] { DateFilter.Default("~M1.3", null, today, null, yesterday) },

                // M2. specifying period param in query

                new object[] { DateFilter.Match("~M2.1", yesterday, null, today) },
                new object[] { DateFilter.Match("~M2.2", yesterday, today, yesterday, tomorrow) },
                new object[] { DateFilter.Match("~M2.3", null, today, null, yesterday) },

                // I. INTERSECTION TESTS
                // I1. start date only filter

                /*
                 * Event:     [--------------]
                 * Filter:                    [---------------
                 */
                new object[] { DateFilter.Intersect("~I1.1", yesterday, today, tomorrow) },

                // I2. end date only filter

                /*
                 * Event:              [----------]
                 * Filter:    --------]
                 */
                new object[] { DateFilter.Intersect("~I2.1", today, tomorrow, null, yesterday) },

                // I3. start & end date filter

                /*
                 * Event:                    [-------------------]
                 * Filter: [----------------]
                 */
                new object[]
                {
                    DateFilter.Intersect("~I3.1", today.PlusDays(-5), today.PlusDays(5), today.PlusDays(-10),
                                         today.PlusDays(-6))
                },

                /*
                 * Event:     [-------------------]
                 * Filter:                         [-----------------]
                 */
                new object[]
                {
                    DateFilter.Intersect("~I3.2", today.PlusDays(-5), today.PlusDays(5), today.PlusDays(6),
                                         today.PlusDays(10))
                },

                // C. CONTAINS FILTER TESTS

                // C1. start date only filter

                /*
                 * Event:     [-------------------
                 * Filter:      [--------------------
                 */
                new object[] { DateFilter.Contain("~C1.1", yesterday, null, today) },
                new object[] { DateFilter.Contain("~C1.2", today.PlusDays(-1), null, today) },

                /*
                 * Event:     ----------------]
                 * Filter:      [--------------------
                 */
                new object[] { DateFilter.Contain("~C1.3", null, tomorrow, today) },

                /*
                 * Event:     [----------]
                 * Filter:      [--------------------
                 */
                new object[] { DateFilter.Contain("~C1.4", yesterday, tomorrow, today) },

                // C2. end date only filter

                /*
                 * Event:     -----------]
                 * Filter:    ----------]
                 */
                new object[] { DateFilter.Contain("~C2.1", null, tomorrow, null, today) },
                new object[] { DateFilter.Contain("~C2.2", null, today.PlusDays(-1), null, today) },

                /*
                 * Event:     [----------]
                 * Filter:    ----------]
                 */
                new object[] { DateFilter.Contain("~C2.3", yesterday, tomorrow, null, today) },
                new object[] { DateFilter.Contain("~C2.4", yesterday, today.PlusDays(1), null, today) },

                // C3. start & end date filter

                /*
                 * Event:                   [-------------------]
                 * Filter: [----------------]
                 */
                new object[]
                {
                    DateFilter.Contain("~C3.1", today.PlusDays(-5), today.PlusDays(5), today.PlusDays(-10),
                                       today.PlusDays(-5))
                },

                /*
                 * Event:       [-------------------]
                 * Filter: [-------------]
                 */
                new object[]
                { DateFilter.Contain("~C3.2", today.PlusDays(-5), today.PlusDays(5), today.PlusDays(-10), today) },

                /*
                 * Event:     [-------------------]
                 * Filter:         [--------]
                 */
                new object[]
                {
                    DateFilter.Contain("~C3.3", today.PlusDays(-10), today.PlusDays(10), today.PlusDays(-5),
                                       today.PlusDays(5))
                },

                /*
                 * Event:     [-------------------]
                 * Filter:               [--------]
                 */
                new object[]
                { DateFilter.Contain("~C3.4", today.PlusDays(-5), today.PlusDays(5), today, today.PlusDays(5)) },

                /*
                 * Event:     [-------------------]
                 * Filter:               [-----------------]
                 */
                new object[]
                { DateFilter.Contain("~C3.5", today.PlusDays(-5), today.PlusDays(5), today, today.PlusDays(10)) },

                /*
                 * Event:     [-------------------]
                 * Filter:                        [-----------------]
                 */
                new object[]
                {
                    DateFilter.Contain("~C3.6", today.PlusDays(-5), today.PlusDays(5), today.PlusDays(5),
                                       today.PlusDays(10))
                }
            });
        }
コード例 #2
0
        public static object[][] GetDateMatchingFilterTestParams()
        {
            var today     = SystemClock.Instance.Today();
            var yesterday = today.PlusDays(-1);
            var tomorrow  = today.PlusDays(1);

            return(new[]
            {
                // M. EXACT MATCH TESTS
                // M1. NOT specifying period param in query

                new object[] { DateFilter.Default("M1.1", yesterday, null, yesterday) },
                new object[] { DateFilter.Default("M1.2", yesterday, today, yesterday, today) },
                new object[] { DateFilter.Default("M1.3", null, today, null, today) },

                // M2. specifying period param in query

                new object[] { DateFilter.Match("M2.1", yesterday, null, yesterday) },
                new object[] { DateFilter.Match("M2.2", yesterday, today, yesterday, today) },
                new object[] { DateFilter.Match("M2.3", null, today, null, today) },

                // I. INTERSECTION TESTS
                // I1. start date only filter

                /*
                 * Event:     [-------------------
                 * Filter:    [-------------------
                 */
                new object[] { DateFilter.Intersect("I1.1", yesterday, null, yesterday) },
                new object[] { DateFilter.Intersect("I1.2", today, null, today) },
                new object[] { DateFilter.Intersect("I1.3", tomorrow, null, tomorrow) },
                new object[]
                {
                    DateFilter.Intersect("I1.4", yesterday, null, yesterday)
                }, // start date itself should be included
                new object[]
                {
                    DateFilter.Intersect("I1.5", tomorrow, null, tomorrow)
                },                                                    // start date itself should be included
                new object[]
                { DateFilter.Intersect("I1.6", today, null, today) }, // start date itself should be included

                /*
                 * Event:     [-------------------
                 * Filter:   [--------------------
                 */
                new object[] { DateFilter.Intersect("I1.7", tomorrow, null, yesterday) },
                new object[] { DateFilter.Intersect("I1.8", tomorrow, null, today) },

                /*
                 * Event:     [-------------------
                 * Filter:      [-----------------
                 */
                new object[] { DateFilter.Intersect("I1.9", yesterday, null, today) },
                new object[] { DateFilter.Intersect("I1.10", yesterday, null, tomorrow) },

                /*
                 * Event:     [--------------]
                 * Filter:    [-----------------
                 */
                new object[] { DateFilter.Intersect("I1.11", today, tomorrow, today) },

                /*
                 * Event:     [--------------]
                 * Filter:                 [---------------
                 */
                new object[] { DateFilter.Intersect("I1.12", yesterday, tomorrow, today) },

                /*
                 * Event:     [--------------]
                 * Filter:                   [---------------
                 */
                new object[] { DateFilter.Intersect("I1.13", yesterday, today, today) }, // end date should be included

                // I2. end date only filter

                /*
                 * Event:     [----------]
                 * Filter:    -----------]
                 */
                new object[]
                {
                    DateFilter.Intersect("I2.1", today.PlusDays(-10), yesterday, null, yesterday)
                }, // end date itself should be included
                new object[] { DateFilter.Intersect("I2.2", yesterday, today, null, today) },
                new object[]
                {
                    DateFilter.Intersect("I2.3", yesterday, today, null, today)
                }, // end date itself should be included
                new object[] { DateFilter.Intersect("I2.4", yesterday, tomorrow, null, tomorrow) },
                new object[] { DateFilter.Intersect("I2.5", yesterday, tomorrow, null, tomorrow) },

                /*
                 * Event:     [----------]
                 * Filter:    --------]
                 */
                new object[] { DateFilter.Intersect("I2.6", yesterday, tomorrow, null, today) },

                // I3. start & end date filter

                /*
                 * Event:                   [-------------------]
                 * Filter: [----------------]
                 */
                new object[]
                {
                    DateFilter.Intersect("I3.1", today.PlusDays(-5), today.PlusDays(5), today.PlusDays(-10),
                                         today.PlusDays(-5))
                },

                /*
                 * Event:       [-------------------]
                 * Filter: [-------------]
                 */
                new object[]
                { DateFilter.Intersect("I3.2", today.PlusDays(-5), today.PlusDays(5), today.PlusDays(-10), today) },

                /*
                 * Event:     [-------------------]
                 * Filter:         [--------]
                 */
                new object[]
                {
                    DateFilter.Intersect("I3.3", today.PlusDays(-10), today.PlusDays(10), today.PlusDays(-5),
                                         today.PlusDays(5))
                },

                /*
                 * Event:     [-------------------]
                 * Filter:               [--------]
                 */
                new object[]
                { DateFilter.Intersect("I3.4", today.PlusDays(-5), today.PlusDays(5), today, today.PlusDays(5)) },

                /*
                 * Event:     [-------------------]
                 * Filter:               [-----------------]
                 */
                new object[]
                { DateFilter.Intersect("I3.5", today.PlusDays(-5), today.PlusDays(5), today, today.PlusDays(10)) },

                /*
                 * Event:     [-------------------]
                 * Filter:                        [-----------------]
                 */
                new object[]
                {
                    DateFilter.Intersect("I3.6", today.PlusDays(-5), today.PlusDays(5), today.PlusDays(5),
                                         today.PlusDays(10))
                },

                /*
                 * Event:     [-------------------]
                 * Filter:  [------------------------]
                 */
                new object[]
                {
                    DateFilter.Intersect("I3.7", today.PlusDays(-5), today.PlusDays(5), today.PlusDays(-10),
                                         today.PlusDays(10))
                },

                // C. CONTAINS FILTER TESTS
                // C1. start date only filter

                /*
                 * Event:     [-------------------
                 * Filter:    [-------------------
                 */
                new object[] { DateFilter.Contain("C1.1", yesterday, null, yesterday) },
                new object[] { DateFilter.Contain("C1.2", today, null, today) },
                new object[] { DateFilter.Contain("C1.3", tomorrow, null, tomorrow) },
                new object[]
                {
                    DateFilter.Contain("C1.4", yesterday, null, yesterday)
                }, // start date itself should be included
                new object[]
                {
                    DateFilter.Contain("C1.5", tomorrow, null, tomorrow)
                },                                                  // start date itself should be included
                new object[]
                { DateFilter.Contain("C1.6", today, null, today) }, // start date itself should be included

                /*
                 * Event:     [-------------------
                 * Filter:   [--------------------
                 */
                new object[] { DateFilter.Contain("C1.7", tomorrow, null, yesterday) },
                new object[] { DateFilter.Contain("C1.8", tomorrow, null, today) },

                /*
                 * Event:     [--------------]
                 * Filter:    [-----------------
                 */
                new object[] { DateFilter.Contain("C1.9", today, tomorrow, today) },

                // C2. end date only filter

                /*
                 * Event:     [----------]
                 * Filter:    -----------]
                 */
                new object[]
                {
                    DateFilter.Contain("C2.1", today.PlusDays(-10), yesterday, null, yesterday)
                }, // end date itself should be included
                new object[]
                {
                    DateFilter.Contain("C2.2", yesterday, today, null, today)
                }, // end date itself should be included
                new object[] { DateFilter.Contain("C2.3", yesterday, tomorrow, null, tomorrow) },

                // C3. start & end date filter

                /*
                 * Event:     [-------------------]
                 * Filter:  [------------------------]
                 */
                new object[]
                {
                    DateFilter.Contain("C3.1", today.PlusDays(-5), today.PlusDays(5), today.PlusDays(-10),
                                       today.PlusDays(10))
                },
            });
        }