예제 #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 PIVLValidationPOPNullflavorPhasePeriodTest()
        {
            PIVL <INT> pivl = new PIVL <INT>();

            pivl.NullFlavor = NullFlavor.NotAsked;
            pivl.Phase      = new IVL <INT>(1);
            pivl.Period     = new PQ(1, "y");
            Assert.IsFalse(pivl.Validate());
        }
예제 #3
0
        public void PIVLValidationNULLPhasePeriodPOPNullflavorTest()
        {
            PIVL <INT> pivl = new PIVL <INT>();

            pivl.NullFlavor = NullFlavor.NotAsked;
            pivl.Phase      = null;
            pivl.Period     = null;
            Assert.IsTrue(pivl.Validate());
        }
예제 #4
0
        public void PIVLValidationNULLNullflavorPhasePeriodTest()
        {
            PIVL <INT> pivl = new PIVL <INT>();

            pivl.NullFlavor = null;
            pivl.Phase      = null;
            pivl.Period     = null;
            Assert.IsFalse(pivl.Validate());
        }
예제 #5
0
        public void PIVLValidationNULLNullflavorPOPPhasePeriodTest()
        {
            PIVL <INT> pivl = new PIVL <INT>();

            pivl.NullFlavor = null;
            pivl.Phase      = new IVL <INT>(1);
            pivl.Period     = new PQ(1, "y");
            Assert.IsTrue(pivl.Validate());
        }
        public void Freq_To_Represent_RepeatTest01()
        {
            // Represents an interval that repeats twice per day
            // No interval specified, only frequency
            PIVL <TS> twicePerDay = new PIVL <TS>
                                        (null, new RTO <INT, PQ>(2, new PQ(1, "d")))
            {
                InstitutionSpecified = true
                                       // indicates whether the exact timing is up to the party executing the schedule
            };

            Assert.IsTrue(twicePerDay.Validate());
        }
        public void Freq_To_Represent_RepeatTest03()
        {
            // create a new period interval with an POPULATED interval
            PIVL <TS> thricePerDay = new PIVL <TS>
                                     (
                new IVL <TS>(DateTime.Now, new DateTime(2013, 01, 01)),
                new RTO <INT, PQ>(3, new PQ(1, "d")))
            {
                InstitutionSpecified = true
                                       // indicates whether the exact timing is up to the party executing the schedule
            };

            Assert.IsTrue(thricePerDay.Validate());
        }
예제 #8
0
        public void PIVLExamplesTest03()
        {
            // Represents an interval of time from 9am-5pm
            IVL <TS> nineToFiveIVL = new IVL <TS>
                                     (
                new TS(new DateTime(2011, 01, 01, 09, 00, 00),
                       DatePrecision.Minute),
                new TS(new DateTime(2011, 01, 01, 17, 00, 00),
                       DatePrecision.Minute)
                                     );

            // create empty period interval (no interval or frequency)
            PIVL <TS> nineToFiveEveryDay = new PIVL <TS>();

            nineToFiveEveryDay.NullFlavor = NullFlavor.Other;
            Assert.IsTrue(nineToFiveEveryDay.Validate());
        }
예제 #9
0
        public void PIVLExamplesTest02()
        {
            // Represents an interval of time from 9am-5pm
            IVL <TS> nineToFiveIVL = new IVL <TS>
                                     (
                new TS(new DateTime(2011, 01, 01, 09, 00, 00),
                       DatePrecision.Minute),
                new TS(new DateTime(2011, 01, 01, 17, 00, 00),
                       DatePrecision.Minute)
                                     );
            PIVL <TS> nineToFiveEveryDay = new PIVL <TS>
                                           (
                nineToFiveIVL,
                new PQ(1, "d")
                                           );

            nineToFiveEveryDay.NullFlavor = NullFlavor.Other;
            Assert.IsFalse(nineToFiveEveryDay.Validate());
        }
예제 #10
0
        public void PIVLParseTest05()
        {
            // Create PIVL instance
            PIVL <TS> pivl = new PIVL <TS>();

            pivl.Period = new PQ(12, "h");
            PQ.UnitConverters.Add(new SimpleSiUnitConverter());
            pivl.Period.Convert("min");
            pivl.Phase       = new IVL <TS>();
            pivl.Phase.High  = null;
            pivl.Phase.Low   = null;
            pivl.Phase.Width = new PQ(10, "min");

            Assert.IsTrue(pivl.Validate());

            // serialize and parse pivl
            var actualXml = R2SerializationHelper.SerializeAsString(pivl);
            var pivl2     = R2SerializationHelper.ParseString <PIVL <TS> >(actualXml);

            Assert.AreEqual(pivl, pivl2);
        }
예제 #11
0
        public void PIVLExamplesTest01()
        {
            // Represents an interval of time from 9am-5pm
            IVL <TS> nineToFiveIVL = new IVL <TS>
                                     (
                // create new lower boundary timestamp (9am)
                new TS(new DateTime(2011, 01, 01, 09, 00, 00),
                       DatePrecision.Minute),

                // create new upper boundary timestamp (5pm)
                new TS(new DateTime(2011, 01, 01, 17, 00, 00),
                       DatePrecision.Minute)
                                     );

            // create new period interval
            PIVL <TS> nineToFiveEveryDay = new PIVL <TS>
                                           (
                nineToFiveIVL,              // specify interval (9am-5pm)
                new PQ(1, "d")              // specify frequency (once per day)
                                           );

            nineToFiveEveryDay.NullFlavor = null;
            Assert.IsTrue(nineToFiveEveryDay.Validate());
        }
예제 #12
0
 public void Freq_To_Represent_RepeatTest01()
 {
     // Represents an interval that repeats twice per day
     // No interval specified, only frequency
     PIVL<TS> twicePerDay = new PIVL<TS>
     (   null, new RTO<INT, PQ>(2, new PQ(1, "d"))  )
     {
         InstitutionSpecified = true
         // indicates whether the exact timing is up to the party executing the schedule
     };
     Assert.IsTrue(twicePerDay.Validate());
 }
예제 #13
0
 public void Freq_To_Represent_RepeatTest03()
 {
     // create a new period interval with an POPULATED interval
     PIVL<TS> thricePerDay = new PIVL<TS>
     (
     new IVL<TS>(DateTime.Now, new DateTime(2013, 01, 01)),
     new RTO<INT, PQ>(3, new PQ(1, "d")))
     {
         InstitutionSpecified = true
         // indicates whether the exact timing is up to the party executing the schedule
     };
     Assert.IsTrue(thricePerDay.Validate());
 }
예제 #14
0
        public void PIVLParseTest05()
        {
            // Create PIVL instance
            PIVL<TS> pivl = new PIVL<TS>();
            pivl.Period = new PQ(12, "h");
            PQ.UnitConverters.Add(new SimpleSiUnitConverter());
            pivl.Period.Convert("min");
            pivl.Phase = new IVL<TS>();
            pivl.Phase.High = null;
            pivl.Phase.Low = null;
            pivl.Phase.Width = new PQ(10, "min");

            Assert.IsTrue(pivl.Validate());

            // serialize and parse pivl
            var actualXml = R2SerializationHelper.SerializeAsString(pivl);
            var pivl2 = R2SerializationHelper.ParseString<PIVL<TS>>(actualXml);
            Assert.AreEqual(pivl, pivl2);
        }
예제 #15
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());
        }
예제 #16
0
        public void PIVLExamplesTest03()
        {
            // Represents an interval of time from 9am-5pm
            IVL<TS> nineToFiveIVL = new IVL<TS>
                (
                    new TS(new DateTime(2011, 01, 01, 09, 00, 00),
                        DatePrecision.Minute),
                    new TS(new DateTime(2011, 01, 01, 17, 00, 00),
                        DatePrecision.Minute)
                );

            // create empty period interval (no interval or frequency)
            PIVL<TS> nineToFiveEveryDay = new PIVL<TS>();

            nineToFiveEveryDay.NullFlavor = NullFlavor.Other;
            Assert.IsTrue(nineToFiveEveryDay.Validate());
        }
예제 #17
0
        public void PIVLExamplesTest01()
        {
            // Represents an interval of time from 9am-5pm
            IVL<TS> nineToFiveIVL = new IVL<TS>
                (
                    // create new lower boundary timestamp (9am)
                    new TS (new DateTime(2011, 01, 01, 09, 00, 00),
                        DatePrecision.Minute),

                    // create new upper boundary timestamp (5pm)
                    new TS(new DateTime(2011, 01, 01, 17, 00, 00),
                        DatePrecision.Minute)   
                );

            // create new period interval
            PIVL<TS> nineToFiveEveryDay = new PIVL<TS>
            (
                nineToFiveIVL,              // specify interval (9am-5pm)
                new PQ(1, "d")              // specify frequency (once per day)
            );
            nineToFiveEveryDay.NullFlavor = null;
            Assert.IsTrue(nineToFiveEveryDay.Validate());
        }
예제 #18
0
 public void PIVLExamplesTest02()
 {
     // Represents an interval of time from 9am-5pm
     IVL<TS> nineToFiveIVL = new IVL<TS>
         (
             new TS(new DateTime(2011, 01, 01, 09, 00, 00),
                 DatePrecision.Minute),
             new TS(new DateTime(2011, 01, 01, 17, 00, 00),
                 DatePrecision.Minute)
         );
     PIVL<TS> nineToFiveEveryDay = new PIVL<TS>
     (
         nineToFiveIVL,
         new PQ(1, "d")
     );
     nineToFiveEveryDay.NullFlavor = NullFlavor.Other;
     Assert.IsFalse(nineToFiveEveryDay.Validate());
 }
예제 #19
0
 public void PIVLValidationNULLNullflavorPhasePeriodTest()
 {
     PIVL<INT> pivl = new PIVL<INT>();
     pivl.NullFlavor = null;
     pivl.Phase = null;
     pivl.Period = null;
     Assert.IsFalse(pivl.Validate());
 }
예제 #20
0
 public void PIVLValidationPOPNullflavorPhasePeriodTest()
 {
     PIVL<INT> pivl = new PIVL<INT>();
     pivl.NullFlavor = NullFlavor.NotAsked;
     pivl.Phase = new IVL<INT>(1);
     pivl.Period = new PQ(1, "y");
     Assert.IsFalse(pivl.Validate());
 }
예제 #21
0
 public void PIVLValidationNULLNullflavorPOPPhasePeriodTest()
 {
     PIVL<INT> pivl = new PIVL<INT>();
     pivl.NullFlavor = null;
     pivl.Phase = new IVL<INT>(1);
     pivl.Period = new PQ(1, "y");
     Assert.IsTrue(pivl.Validate());
 }
예제 #22
0
 public void PIVLValidationNULLPhasePeriodPOPNullflavorTest()
 {
     PIVL<INT> pivl = new PIVL<INT>();
     pivl.NullFlavor = NullFlavor.NotAsked;
     pivl.Phase = null;
     pivl.Period = null;
     Assert.IsTrue(pivl.Validate());
 }