public void ConstructingEIVLTest01()
        {
            // An hour after meal
            EIVL <TS> hourAfterMeal = new EIVL <TS>(
                DomainTimingEventType.Meal,
                new IVL <PQ>(new PQ(1, "h"))
                );

            EIVL <TS> eivl1 = new EIVL <TS>(
                DomainTimingEventType.Meal,
                new IVL <PQ>(
                    new PQ(1, "h")  // high
                    )
                );

            // 1-2 hours before sleep
            EIVL <TS> beforeSleep = new EIVL <TS>(
                DomainTimingEventType.HourOfSleep,
                new IVL <PQ>(new PQ(-2, "h"), new PQ(-1, "h"))
                );

            // Construct instructions as a union of the two
            GTS instructionTime = new GTS();

            instructionTime.Hull = QSU <TS> .CreateQSU(
                hourAfterMeal,
                beforeSleep
                );

            Assert.IsTrue(eivl1.Validate());

            Assert.IsTrue(hourAfterMeal.Validate());
            Assert.IsTrue(beforeSleep.Validate());
            Assert.IsTrue(instructionTime.Validate());
        }
Esempio n. 2
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());
        }
Esempio n. 3
0
        public void GTSExamplesTest06()
        {
            // Create empty instance of GTS
            GTS labourDay = new GTS();

            labourDay.NullFlavor = NullFlavor.Other;
            Console.WriteLine(labourDay);
            Assert.IsTrue(labourDay.Validate());
        }
Esempio n. 4
0
        public void GTSExamplesTest04()
        {
            // Create empty instance of GTS
            GTS labourDay = new GTS();

            labourDay.NullFlavor = null;

            Console.WriteLine(labourDay);
            Assert.IsFalse(labourDay.Validate());
        }
Esempio n. 5
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());
        }
Esempio n. 6
0
 public void GTSExamplesTest06()
 {
     // Create empty instance of GTS
     GTS labourDay = new GTS();
     labourDay.NullFlavor = NullFlavor.Other;
     Console.WriteLine(labourDay);
     Assert.IsTrue(labourDay.Validate());
 }
Esempio n. 7
0
        public void GTSExamplesTest04()
        {
            // Create empty instance of GTS
            GTS labourDay = new GTS();
            labourDay.NullFlavor = null;

            Console.WriteLine(labourDay);
            Assert.IsFalse(labourDay.Validate());
        }
Esempio n. 8
0
        public void ConstructingEIVLTest01()
        {
            // An hour after meal
            EIVL<TS> hourAfterMeal = new EIVL<TS>(
                DomainTimingEventType.Meal,
                new IVL<PQ>(new PQ(1, "h"))
                );

            EIVL<TS> eivl1 = new EIVL<TS>(
                DomainTimingEventType.Meal,
                new IVL<PQ>(
                    new PQ(1, "h")  // high
                )
                );

            // 1-2 hours before sleep
            EIVL<TS> beforeSleep = new EIVL<TS>(
                DomainTimingEventType.HourOfSleep,
                new IVL<PQ>( new PQ(-2, "h"), new PQ(-1, "h") )
                );

            // Construct instructions as a union of the two
            GTS instructionTime = new GTS();
            instructionTime.Hull = QSU<TS>.CreateQSU(
                hourAfterMeal,
                beforeSleep
                );

            Assert.IsTrue(eivl1.Validate());

            Assert.IsTrue(hourAfterMeal.Validate());
            Assert.IsTrue(beforeSleep.Validate());
            Assert.IsTrue(instructionTime.Validate());
        }