Example #1
0
        public void QSETExamplesTest04()
        {
            QSI <INT> setExpression = new QSI <INT>();

            setExpression.NullFlavor = NullFlavor.Other;
            Assert.IsTrue(setExpression.Validate());
        }
Example #2
0
        public void QSETExamplesTest01()
        {
            // create a new intersection set expression
            // (difference of 2 intervals is intersected with a third interval)
            QSI <INT> setExpression = QSI <INT> .CreateQSI
                                      (
                // creates the set expression by differentiating two intervals
                new QSD <INT>(
                    new IVL <INT>(1, 10)
            {
                LowClosed = true,
                HighClosed = true
            },
                    new IVL <INT>(5, 8)
            {
                LowClosed = true,
                HighClosed = true
            }
                    ),

                // third interval
                new IVL <INT>(2, 7)
            {
                LowClosed  = true,
                HighClosed = true
            }
                                      );

            setExpression.NullFlavor = null;
            Assert.IsTrue(setExpression.Validate());
        }
Example #3
0
        public void QSETExamplesTest02()
        {
            QSI <INT> setExpression = QSI <INT> .CreateQSI
                                      (
                new QSD <INT>(
                    new IVL <INT>(1, 10)
            {
                LowClosed = true,
                HighClosed = true
            },
                    new IVL <INT>(5, 8)
            {
                LowClosed = true,
                HighClosed = true
            }
                    ),
                new IVL <INT>(2, 7)
            {
                LowClosed  = true,
                HighClosed = true
            }
                                      );

            setExpression.NullFlavor = NullFlavor.Other;
            Assert.IsFalse(setExpression.Validate());
        }
Example #4
0
        public void QSETExamplesTest03()
        {
            QSI <INT> setExpression = new QSI <INT>();

            setExpression.NullFlavor = null;
            Assert.IsFalse(setExpression.Validate());
        }
Example #5
0
        public void R2TELUseablePeriodParseTest()
        {
            var tel = new TEL("tel:+190555525485");

            // This PIVL<TS> selects the week of Aug 15 2011 - Aug 19 2011
            var weekdays = new PIVL <TS>(
                new IVL <TS>(DateTime.Parse("08-15-2011"), DateTime.Parse("08-19-2011")),
                new PQ(1, "wk")
                );

            // This PIVL<TS> selects the hours of 9-5
            var nineToFive = new PIVL <TS>(
                new IVL <TS>(DateTime.Parse("08-15-2011 09:00 AM"), DateTime.Parse("08-15-2011 05:00 PM")),
                new PQ(1, "d")
                );

            // We set the usable period to a set of
            // 1. All weekdays
            // 2. intersect with times from 9-5 daily
            tel.UseablePeriod = new GTS(QSI <TS> .CreateQSI(
                                            weekdays,
                                            nineToFive
                                            ));

            var actualXml = R2SerializationHelper.SerializeAsString(tel);
            var inti      = R2SerializationHelper.ParseString <TEL>(actualXml);

            Assert.AreEqual(tel, inti);
        }
Example #6
0
        public void GTSExamplesTest01()
        {
            // Create a periodic interval with first week of all Septembers
            PIVL <TS> firstWeekofSept = new PIVL <TS>
                                        (
                new IVL <TS>(
                    new TS(new DateTime(2011, 09, 01), DatePrecision.Day),
                    new TS(new DateTime(2011, 09, 08), DatePrecision.Day)
                    ),
                new PQ(1, "a")
                                        );

            // Create a periodic interval of all mondays
            PIVL <TS> mondays = new PIVL <TS>
                                (
                new TS(new DateTime(2011, 01, 03), DatePrecision.Day).ToIVL(),
                new PQ(1, "wk")
                                );

            // Intersect to get labour day
            GTS labourDay = new GTS(
                QSI <TS> .CreateQSI(
                    firstWeekofSept,
                    mondays
                    )
                );

            labourDay.NullFlavor = null;
            Console.WriteLine(labourDay);
            Assert.IsTrue(labourDay.Validate());
        }
Example #7
0
        public void GTSExamplesTest03()
        {
            // Create a periodic interval with first week of all Septembers
            PIVL <TS> firstWeekofSept = new PIVL <TS>
                                        (
                new IVL <TS>(
                    new TS(new DateTime(2011, 09, 01), DatePrecision.Day),
                    new TS(new DateTime(2011, 09, 08), DatePrecision.Day)
                    ),
                new PQ(1, "a")
                                        );

            // Create a periodic interval of all mondays
            PIVL <TS> mondays = new PIVL <TS>(
                new IVL <TS>(
                    new TS(new DateTime(2011, 02, 03), DatePrecision.Day)
                    ),
                new PQ(1, "wk")
                );

            // Create a second periodic interval of all mondays
            PIVL <TS> mondays2 = new PIVL <TS>(
                new TS(new DateTime(2011, 01, 03), DatePrecision.Day).ToIVL(),
                new PQ(1, "wk")
                );

            // Intersect to get labour day
            GTS labourDay = new GTS(
                QSI <TS> .CreateQSI(
                    firstWeekofSept,
                    mondays
                    )
                );

            // Intersect to get labour day
            GTS labourDay2 = new GTS(
                QSI <TS> .CreateQSI(
                    firstWeekofSept,
                    mondays2
                    )
                );

            Console.WriteLine(mondays);
            Console.WriteLine(mondays2);
            Assert.AreNotEqual(labourDay, labourDay2);
        }
Example #8
0
 public void QSETExamplesTest04()
 {
     QSI<INT> setExpression = new QSI<INT>();
     setExpression.NullFlavor = NullFlavor.Other;
     Assert.IsTrue(setExpression.Validate());
 }
Example #9
0
 public void QSETExamplesTest03()
 {
     QSI<INT> setExpression = new QSI<INT>();
     setExpression.NullFlavor = null;
     Assert.IsFalse(setExpression.Validate());
 }