예제 #1
0
        public void PIVL_ConstainsTest01()
        {
            // Find a time that is a Saturday like Saturday November 12, 2011
            // and repeat it every week
            PIVL <TS> saturdays = new PIVL <TS>
                                  (
                new TS(new DateTime(2011, 11, 12), DatePrecision.Day).ToIVL(),
                new PQ(1, "wk")
                                  );

            // Determine if November 19, 2011 is a member of the PIVL
            // and if December 20, 2011 is a member

            TS nov19 = new TS(new DateTime(2011, 11, 19), DatePrecision.Day),
               dec20 = new TS(new DateTime(2011, 12, 20), DatePrecision.Day);

            // outout the date and the result of the contains function
            Console.WriteLine("'{0}' a Saturday? {1}\r\n'{2} a Saturday? {3}",
                              nov19.DateValue,
                              saturdays.Contains(nov19),
                              dec20.DateValue,
                              saturdays.Contains(dec20)
                              );

            Assert.IsTrue(saturdays.Validate());
        }
예제 #2
0
        public void PIVLTSExtensionExtremityNotContainmentTest()
        {
            // Every Monday
            PIVL <TS> start = new PIVL <TS>(
                new IVL <TS>(DateTime.Parse("2011-05-02"), DateTime.Parse("2011-05-06")),
                (PQ)"1 wk"
                );

            Assert.IsFalse(start.Contains((TS)DateTime.Parse("2025-04-27 5:55:00 PM")));
        }
예제 #3
0
        public void PIVLTSExtensionExtremityContainmentTest()
        {
            // Every Monday
            PIVL <TS> start = new PIVL <TS>(
                new IVL <TS>(DateTime.Parse("2011-05-01"), DateTime.Parse("2011-05-07")),
                (PQ)"1 a"
                );

            Assert.IsTrue(start.Contains((TS)DateTime.Parse("2025-05-04 5:55:00 PM")));
        }
예제 #4
0
        public void PIVLTSNotContainmentTest()
        {
            // Every Monday
            PIVL <TS> start = new PIVL <TS>(
                new IVL <TS>(DateTime.Parse("2011-08-29"), null)
            {
                Width = new PQ(1, "d")
            },
                (PQ)"1 wk"
                );

            Assert.IsFalse(start.Contains((TS)DateTime.Parse("2012-05-09 5:55:00 PM")));
        }
예제 #5
0
        public void PIVLPQNotContainmentTest()
        {
            // 3 - 6 ft with period of 20 ft
            // PIVL has set of
            // 3..6, 23..26, 43..46
            PQ.UnitConverters.Add(new SimpleSiUnitConverter());
            PIVL <PQ> start = new PIVL <PQ>(
                new IVL <PQ>((PQ)"3 ft", (PQ)"6 ft"),
                (PQ)"20 ft"
                );

            Assert.IsFalse(start.Contains((PQ)"18 ft"));
        }
예제 #6
0
        public void PIVLPQExtensionContainmentTest()
        {
            // 3 - 6 ft with period of 20 ft
            // PIVL has set of
            // 3..6, 23..26, 43..46
            PQ.UnitConverters.Add(new SimpleSiUnitConverter());
            PIVL <PQ> start = new PIVL <PQ>(
                new IVL <PQ>((PQ)"3 m", (PQ)"6 m"),
                (PQ)"10 km"
                );

            Assert.IsTrue(start.Contains((PQ)"60.004 km"));
        }
예제 #7
0
 public void PIVLTSNotContainmentTest()
 {
     // Every Monday
     PIVL<TS> start = new PIVL<TS>(
         new IVL<TS>(DateTime.Parse("2011-08-29"), null) { Width = new PQ(1, "d") },
         (PQ)"1 wk"
     );
     Assert.IsFalse(start.Contains((TS)DateTime.Parse("2012-05-09 5:55:00 PM")));
 }
예제 #8
0
 public void PIVLTSExtensionExtremityNotContainmentTest()
 {
     // Every Monday
     PIVL<TS> start = new PIVL<TS>(
         new IVL<TS>(DateTime.Parse("2011-05-02"), DateTime.Parse("2011-05-06")),
         (PQ)"1 wk"
     );
     Assert.IsFalse(start.Contains((TS)DateTime.Parse("2025-04-27 5:55:00 PM")));
 }
예제 #9
0
 public void PIVLTSExtensionExtremityContainmentTest()
 {
     // Every Monday
     PIVL<TS> start = new PIVL<TS>(
         new IVL<TS>(DateTime.Parse("2011-05-01"), DateTime.Parse("2011-05-07")),
         (PQ)"1 a"
     );
     Assert.IsTrue(start.Contains((TS)DateTime.Parse("2025-05-04 5:55:00 PM")));
 }
예제 #10
0
 public void PIVLPQNotContainmentTest()
 {
     // 3 - 6 ft with period of 20 ft
     // PIVL has set of
     // 3..6, 23..26, 43..46
     PQ.UnitConverters.Add(new SimpleSiUnitConverter());
     PIVL<PQ> start = new PIVL<PQ>(
         new IVL<PQ>((PQ)"3 ft", (PQ)"6 ft"),
         (PQ)"20 ft"
     );
     Assert.IsFalse(start.Contains((PQ)"18 ft"));
 }
예제 #11
0
 public void PIVLPQExtensionContainmentTest()
 {
     // 3 - 6 ft with period of 20 ft
     // PIVL has set of
     // 3..6, 23..26, 43..46
     PQ.UnitConverters.Add(new SimpleSiUnitConverter());
     PIVL<PQ> start = new PIVL<PQ>(
         new IVL<PQ>((PQ)"3 m", (PQ)"6 m"),
         (PQ)"10 km"
     );
     Assert.IsTrue(start.Contains((PQ)"60.004 km"));
 }
예제 #12
0
        public void PIVL_ConstainsTest01()
        {
            // Find a time that is a Saturday like Saturday November 12, 2011
            // and repeat it every week
            PIVL<TS> saturdays = new PIVL<TS>
            (
                new TS(new DateTime(2011, 11, 12), DatePrecision.Day).ToIVL(),
                new PQ(1, "wk")
            );
            
            // Determine if November 19, 2011 is a member of the PIVL
            // and if December 20, 2011 is a member

            TS nov19 = new TS(new DateTime(2011, 11, 19), DatePrecision.Day),
                dec20 = new TS(new DateTime(2011, 12, 20), DatePrecision.Day);

            // outout the date and the result of the contains function
            Console.WriteLine("'{0}' a Saturday? {1}\r\n'{2} a Saturday? {3}",
                nov19.DateValue,
                saturdays.Contains(nov19),
                dec20.DateValue,
                saturdays.Contains(dec20)
                );

            Assert.IsTrue(saturdays.Validate());
        }