public void TELExample8Test01() { var tel = new TEL("tel:+190555525485"); var weekdays = new PIVL <TS>( new IVL <TS>(DateTime.Parse("08-15-2011"), DateTime.Parse("08-19-2011")), new PQ(-1, "wk") ); var nineToFive = new PIVL <TS>( // given low, high, and inaccurate width new IVL <TS>(DateTime.Parse("08-15-2011 09:00 AM"), DateTime.Parse("08-19-2011 05:00 PM")), new PQ(-1, "d") ) { Operator = SetOperator.Intersect }; tel.UseablePeriod = new GTS(new SXPR <TS>( new SXCM <TS>[] { weekdays, nineToFive } )); tel.Use = null; Assert.IsTrue(tel.Validate()); }
public void GTSTestXsiOutputPIVL_TS_Test() { // Constrct a GTS GTS test = new PIVL<TS>(new IVL<TS>(DateTime.Today, DateTime.Now), new PQ(1, "d")); String xml = R1SerializationHelper.SerializeAsString(test, Formatters.XML.Datatypes.R1.DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture); Assert.IsTrue(xml.Contains("xsi:type=\"PIVL_TS\"")); }
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()); }
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()); }
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); }
public void GTSTestXsiOutputPIVL_TS_Test() { // Constrct a GTS GTS test = new PIVL <TS>(new IVL <TS>(DateTime.Today, DateTime.Now), new PQ(1, "d")); String xml = R1SerializationHelper.SerializeAsString(test, Formatters.XML.Datatypes.R1.DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture); Assert.IsTrue(xml.Contains("xsi:type=\"PIVL_TS\"")); }
public void PIVLValidationNULLPhasePeriodPOPNullflavorTest() { PIVL <INT> pivl = new PIVL <INT>(); pivl.NullFlavor = NullFlavor.NotAsked; pivl.Phase = null; pivl.Period = null; Assert.IsTrue(pivl.Validate()); }
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()); }
public void PIVLValidationNULLNullflavorPhasePeriodTest() { PIVL <INT> pivl = new PIVL <INT>(); pivl.NullFlavor = null; pivl.Phase = null; pivl.Period = null; Assert.IsFalse(pivl.Validate()); }
public override void Dispose() { if (!base._isDisposed) { _value = null; GC.SuppressFinalize(this); base._isDisposed = !base._isDisposed; } }
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 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"))); }
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"))); }
public void GTSPIVLCTORTest() { PIVL <TS> everyTwoDays = new PIVL <TS>( // this is every other day new IVL <TS>(DateTime.Parse("2010/05/1"), DateTime.Parse("2010/05/10")), new PQ((decimal)2.0, "d")); GTS gtsInstance = new GTS(everyTwoDays); Assert.AreEqual(typeof(PIVL <TS>), gtsInstance.Hull.GetType()); }
internal static PIVL <TS> CreatePIVLTS(UseContext context) { Tracer.Trace("Creating PIVL", context); PIVL <TS> result = new PIVL <TS>( CreateIVLTS(context), new PQ((decimal)1.0, "d") ); return(result); }
public void PIVLSerializationTest01() { // Create PIVL instance PIVL <TS> pivl = new PIVL <TS>(); pivl.Period = new PQ(12, "h"); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" ><period value=""12"" unit=""h""/></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pivl); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
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 PIVLParseTest04() { // Create PIVL instance PIVL <TS> pivl = new PIVL <TS>(); pivl.Period = new PQ(3, "h"); // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pivl); var pivl2 = R2SerializationHelper.ParseString <PIVL <TS> >(actualXml); Assert.AreEqual(pivl, pivl2); }
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"))); }
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")); }
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")); }
public void PIVLSerializationTest08() { // Create PIVL instance PIVL <TS> pivl = new PIVL <TS>(); pivl.Period = new PQ(5, "h"); pivl.Period.UncertaintyType = new QuantityUncertaintyType(); pivl.Period.Uncertainty = new PQ((decimal)0.57735, "h"); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><period value=""5"" unit=""h"" uncertaintyType=""U""><uncertainty xsi:type=""PQ"" value=""0.57735"" unit=""h"" /></period></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pivl); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
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()); }
public void PIVLSerializationTest03() { // Create PIVL instance PIVL <TS> pivl = new PIVL <TS>(); pivl.Frequency = new RTO <INT, PQ>() { Numerator = 7, Denominator = new PQ(1, "d") }; var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><frequency><numerator xsi:type=""INT"" value=""7""/><denominator xsi:type=""PQ"" value=""1"" unit=""d""/></frequency></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pivl); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void PIVLSerializationTest07() { // Create PIVL instance PIVL <TS> pivl = new PIVL <TS>(); pivl.Period = new PQ(2, "wk"); pivl.Phase = new IVL <TS>( new TS(new DateTime(2000, 12, 02), DatePrecision.Day), new TS(new DateTime(2000, 12, 03), DatePrecision.Day) ); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><phase><low value=""20001202""/><high value=""20001203""/></phase><period value=""2"" unit=""wk""/></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pivl); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void PIVLSerializationTest06() { // Create PIVL instance PIVL <TS> pivl = new PIVL <TS>(); pivl.Period = new PQ(1, "a"); pivl.Phase = new IVL <TS>( new TS(new DateTime(1987, 09, 01), DatePrecision.Month), new TS(new DateTime(1987, 10, 01), DatePrecision.Month) ); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><phase><low value=""198709""/><high value=""198710""/></phase><period value=""1"" unit=""a""/></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pivl); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
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()); }
public void PIVLParseTest06() { // Create PIVL instance PIVL <TS> pivl = new PIVL <TS>(); pivl.Period = new PQ(1, "a"); pivl.Phase = new IVL <TS>( new TS(new DateTime(1987, 09, 01), DatePrecision.Month), new TS(new DateTime(1987, 10, 01), DatePrecision.Month) ); // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pivl); var pivl2 = R2SerializationHelper.ParseString <PIVL <TS> >(actualXml); Assert.AreEqual(pivl, pivl2); }
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); }
public void PIVLParseTest03() { // Create PIVL instance PIVL <TS> pivl = new PIVL <TS>(); pivl.Frequency = new RTO <INT, PQ>() { Numerator = 7, Denominator = new PQ(1, "d") }; // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pivl); var pivl2 = R2SerializationHelper.ParseString <PIVL <TS> >(actualXml); Assert.AreEqual(pivl, pivl2); }
public void PIVLParseTest07() { // Create PIVL instance PIVL <TS> pivl = new PIVL <TS>(); pivl.Period = new PQ(2, "wk"); pivl.Phase = new IVL <TS>( new TS(new DateTime(2000, 12, 02), DatePrecision.Day), new TS(new DateTime(2000, 12, 03), DatePrecision.Day) ); // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pivl); var pivl2 = R2SerializationHelper.ParseString <PIVL <TS> >(actualXml); Assert.AreEqual(pivl, pivl2); }
public void PIVLParseTest04() { // Create PIVL instance PIVL<TS> pivl = new PIVL<TS>(); pivl.Period = new PQ(3, "h"); // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pivl); var pivl2 = R2SerializationHelper.ParseString<PIVL<TS>>(actualXml); Assert.AreEqual(pivl, pivl2); }
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()); }
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()); }
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"))); }
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"))); }
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")); }
public void PIVLParseTest07() { // Create PIVL instance PIVL<TS> pivl = new PIVL<TS>(); pivl.Period = new PQ(2, "wk"); pivl.Phase = new IVL<TS>( new TS(new DateTime(2000, 12, 02), DatePrecision.Day), new TS(new DateTime(2000, 12, 03), DatePrecision.Day) ); // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pivl); var pivl2 = R2SerializationHelper.ParseString<PIVL<TS>>(actualXml); Assert.AreEqual(pivl, pivl2); }
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); }
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()); }
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); }
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()); }
public void PIVLParseTest06() { // Create PIVL instance PIVL<TS> pivl = new PIVL<TS>(); pivl.Period = new PQ(1, "a"); pivl.Phase = new IVL<TS>( new TS(new DateTime(1987, 09, 01), DatePrecision.Month), new TS(new DateTime(1987, 10, 01), DatePrecision.Month) ); // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pivl); var pivl2 = R2SerializationHelper.ParseString<PIVL<TS>>(actualXml); Assert.AreEqual(pivl, pivl2); }
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()); }
public void PIVLSerializationTest01() { // Create PIVL instance PIVL<TS> pivl = new PIVL<TS>(); pivl.Period = new PQ(12, "h"); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" ><period value=""12"" unit=""h""/></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pivl); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
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()); }
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")); }
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()); }
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"))); }
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 GTSPIVLCTORTest() { PIVL<TS> everyTwoDays = new PIVL<TS>( // this is every other day new IVL<TS>(DateTime.Parse("2010/05/1"), DateTime.Parse("2010/05/10")), new PQ((decimal)2.0, "d")); GTS gtsInstance = new GTS(everyTwoDays); Assert.AreEqual(typeof(PIVL<TS>), gtsInstance.Hull.GetType()); }
public void PIVLParseTest03() { // Create PIVL instance PIVL<TS> pivl = new PIVL<TS>(); pivl.Frequency = new RTO<INT, PQ>() { Numerator = 7, Denominator = new PQ(1, "d") }; // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pivl); var pivl2 = R2SerializationHelper.ParseString<PIVL<TS>>(actualXml); Assert.AreEqual(pivl, pivl2); }
public void PIVLSerializationTest03() { // Create PIVL instance PIVL<TS> pivl = new PIVL<TS>(); pivl.Frequency = new RTO<INT, PQ>() { Numerator = 7, Denominator = new PQ(1, "d") }; var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><frequency><numerator xsi:type=""INT"" value=""7""/><denominator xsi:type=""PQ"" value=""1"" unit=""d""/></frequency></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pivl); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void PIVLValidationNULLNullflavorPhasePeriodTest() { PIVL<INT> pivl = new PIVL<INT>(); pivl.NullFlavor = null; pivl.Phase = null; pivl.Period = null; Assert.IsFalse(pivl.Validate()); }
public void PIVLSerializationTest06() { // Create PIVL instance PIVL<TS> pivl = new PIVL<TS>(); pivl.Period = new PQ(1, "a"); pivl.Phase = new IVL<TS>( new TS(new DateTime(1987,09, 01), DatePrecision.Month), new TS(new DateTime(1987, 10, 01), DatePrecision.Month) ); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><phase><low value=""198709""/><high value=""198710""/></phase><period value=""1"" unit=""a""/></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pivl); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void PIVLSerializationTest07() { // Create PIVL instance PIVL<TS> pivl = new PIVL<TS>(); pivl.Period = new PQ(2, "wk"); pivl.Phase = new IVL<TS>( new TS(new DateTime(2000, 12, 02), DatePrecision.Day), new TS(new DateTime(2000, 12, 03), DatePrecision.Day) ); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><phase><low value=""20001202""/><high value=""20001203""/></phase><period value=""2"" unit=""wk""/></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pivl); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void TELExample8Test02() { var tel = new TEL("tel:+190555525485"); var weekdays = new PIVL<TS>( new IVL<TS>(DateTime.Parse("08-15-2011"), DateTime.Parse("08-19-2011")), new PQ(-1, "wk") ); var nineToFive = new PIVL<TS>( // given low, high, and inaccurate width new IVL<TS>(DateTime.Parse("08-15-2011 09:00 AM"), DateTime.Parse("08-19-2011 05:00 PM")), new PQ(-1, "d") ) { Operator = SetOperator.Intersect }; tel.UseablePeriod = null; tel.Use = null; Assert.IsTrue(tel.Validate()); }
public void PIVLSerializationTest08() { // Create PIVL instance PIVL<TS> pivl = new PIVL<TS>(); pivl.Period = new PQ(5, "h"); pivl.Period.UncertaintyType = new QuantityUncertaintyType(); pivl.Period.Uncertainty = new PQ((decimal)0.57735, "h"); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><period value=""5"" unit=""h"" uncertaintyType=""U""><uncertainty xsi:type=""PQ"" value=""0.57735"" unit=""h"" /></period></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pivl); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
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 PIVLValidationNULLPhasePeriodPOPNullflavorTest() { PIVL<INT> pivl = new PIVL<INT>(); pivl.NullFlavor = NullFlavor.NotAsked; pivl.Phase = null; pivl.Period = null; Assert.IsTrue(pivl.Validate()); }