public void CountWithMinParserTest()
        {
            CountWithMin countWithMinOf1     = new CountWithMin(1);
            CountWithMin countWithMinOf99999 = new CountWithMin(99999);

            TestUtil.TestPropertyParser("1-*", countWithMinOf1);
            TestUtil.TestPropertyParser("\t\t  1-* \n\n \t", countWithMinOf1);

            TestUtil.TestPropertyParser("99999-*", countWithMinOf99999);
            TestUtil.TestPropertyParser("\t\t  99999-* \n\n \t", countWithMinOf99999);

            //
            // Test that it disallows CountWithMin(0)
            //
            #if DEBUG
            try
            {
                CountWithMin countWithMin = new CountWithMin(0);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException e)
            {
                Console.WriteLine(String.Format("Caught expected exception {0}", e));
            }
            #endif

            //
            // Test some larger Count with min
            //
            for (UInt32 i = 1; i < 1000000; i += 95416)
            {
                CountWithMin countWithMin = (CountWithMin)CountProperty.Parse(i.ToString() + "-*");
                Assert.AreEqual(i, countWithMin.min);
            }
        }
Esempio n. 2
0
        public Boolean Equals(ICountProperty countProperty)
        {
            CountWithMin countWithMin = countProperty as CountWithMin;

            if (countWithMin == null)
            {
                return(false);
            }
            return(this.min == countWithMin.min);
        }