public string FormatDir( PQR constant, int constantVal ) { switch( constant ) { case PQR.P: return string.Format( "{0}qr", NorI( constantVal ) ); case PQR.Q: return string.Format( "p{0}r", NorI( constantVal ) ); case PQR.R: return string.Format( "pq{0}", NorI( constantVal ) ); } throw new System.ArgumentException(); }
public void PQRSerializationTest03() { PQR pqr = new PQR(3, "fakeCode", "fakeCodeSystem"); pqr.NullFlavor = null; pqr.ValidTimeHigh = null; pqr.ValidTimeLow = null; pqr.UpdateMode = null; pqr.OriginalText = null; Console.WriteLine("Value: {0} | Code: {1} | Codesystem: {2}", pqr.Value, pqr.Code, pqr.CodeSystem); Assert.IsTrue(pqr.Validate()); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" value=""3"" code=""fakeCode"" codeSystem=""fakeCodeSystem""></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pqr); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void PQRParseTest03() { PQR pqr = new PQR(3, "fakeCode", "fakeCodeSystem"); pqr.NullFlavor = null; pqr.ValidTimeHigh = null; pqr.ValidTimeLow = null; pqr.UpdateMode = null; pqr.OriginalText = null; Console.WriteLine("Value: {0} | Code: {1} | Codesystem: {2}", pqr.Value, pqr.Code, pqr.CodeSystem); Assert.IsTrue(pqr.Validate()); // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pqr); var pqr2 = R2SerializationHelper.ParseString <PQR>(actualXml); Assert.AreEqual(pqr, pqr2); }
public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Since PQR is a CV , we can use the CD formatter to graph the basic attributes onto the stream PQR instance = o as PQR; if (instance.NullFlavor == null) { // Null, no need to format // Watch out for nargles if (instance.Precision != null && instance.Precision != 0 && instance.Value.HasValue) { s.WriteAttributeString("value", instance.Value.Value.ToString(String.Format("0.{0}", new String('0', instance.Precision), DatatypeFormatter.FormatterCulture.NumberFormat.NumberDecimalSeparator), DatatypeFormatter.FormatterCulture)); } else if (instance.Value.HasValue) { s.WriteAttributeString("value", instance.Value.Value.ToString(DatatypeFormatter.FormatterCulture)); } } base.Graph(s, o as PQR, result); }
public void PQRSerializationTest08() { PQR pqr = new PQR(3, "[ft_i]", "2.16.840.1.113883.6.8"); pqr.ValidTimeLow = new TS(new DateTime(2012, 01, 01), DatePrecision.Day); pqr.ValidTimeHigh = new TS(new DateTime(2012, 12, 31), DatePrecision.Day); pqr.NullFlavor = null; pqr.UpdateMode = UpdateMode.Add; pqr.CodeSystemName = "Fake Name"; pqr.CodeSystemVersion = "1.0"; pqr.ValueSet = "Fake VS"; pqr.ValueSetVersion = "1.0"; pqr.DisplayName = "Fake DN"; pqr.OriginalText = "3 Feet"; Console.WriteLine("Value: {0} | Code: {1} | Codesystem: {2}", pqr.Value, pqr.Code, pqr.CodeSystem); Assert.IsTrue(pqr.Validate()); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" value=""3"" code=""[ft_i]"" codeSystem=""2.16.840.1.113883.6.8"" validTimeHigh=""20121231"" validTimeLow=""20120101"" updateMode=""A"" codeSystemName=""Fake Name"" codeSystemVersion=""1.0"" valueSet=""Fake VS"" valueSetVersion=""1.0""><displayName value=""Fake DN"" language=""en-US"" /><originalText value=""3 Feet"" language=""en-US"" /></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pqr); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Since PQR is a CV , we can use the CD formatter to graph the basic attributes onto the stream CVFormatter formatter = new CVFormatter(); PQR instance = o as PQR; if (instance.NullFlavor != null) { return; // Null, no need to format } // Watch out for nargles if (instance.Precision != null && instance.Precision != 0 && instance.Value.HasValue) { s.WriteAttributeString("value", instance.Value.Value.ToString(String.Format("0.{0}", new String('0', instance.Precision)))); } else if (instance.Value.HasValue) { s.WriteAttributeString("value", instance.Value.Value.ToString()); } formatter.Graph(s, o as PQR, result); }
public void PQRParseTest08() { PQR pqr = new PQR(3, "[ft_i]", "2.16.840.1.113883.6.8"); pqr.ValidTimeLow = new TS(new DateTime(2012, 01, 01), DatePrecision.Day); pqr.ValidTimeHigh = new TS(new DateTime(2012, 12, 31), DatePrecision.Day); pqr.NullFlavor = null; pqr.UpdateMode = UpdateMode.Add; pqr.CodeSystemName = "Fake Name"; pqr.CodeSystemVersion = "1.0"; pqr.ValueSet = "Fake VS"; pqr.ValueSetVersion = "1.0"; pqr.DisplayName = "Fake DN"; pqr.OriginalText = "3 Feet"; Console.WriteLine("Value: {0} | Code: {1} | Codesystem: {2}", pqr.Value, pqr.Code, pqr.CodeSystem); Assert.IsTrue(pqr.Validate()); // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pqr); var pqr2 = R2SerializationHelper.ParseString <PQR>(actualXml); Assert.AreEqual(pqr, pqr2); }
public void PQRSerializationTest02() { PQR pqr = new PQR(3, "[ft_i]", "2.16.840.1.113883.6.8"); pqr.ValidTimeLow = null; pqr.ValidTimeHigh = null; pqr.ControlActRoot = null; pqr.ControlActExt = null; pqr.NullFlavor = NullFlavor.Unknown; pqr.UpdateMode = null; pqr.CodeSystemName = null; pqr.CodeSystemVersion = null; pqr.ValueSet = null; pqr.ValueSetVersion = null; pqr.DisplayName = null; pqr.OriginalText = null; Console.WriteLine("Value: {0} | Code: {1} | Codesystem: {2}", pqr.Value, pqr.Code, pqr.CodeSystem); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" nullFlavor=""UNK""></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pqr); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void PQRValueCode3Test() { PQR pqr = new PQR((decimal)7.4322, "", null); pqr.NullFlavor = null; Assert.IsTrue(pqr.Validate()); }
public void PQRValueCode2Test() { Double value = 3.42346; String code = ""; String codesystem = null; PQR pqr = new PQR((decimal)value, code, codesystem); pqr.NullFlavor = null; pqr.Precision = 2; Assert.IsTrue(pqr.Validate()); }
public void PQRValueCodeCodeSystem3Test() { PQR pqr = new PQR((decimal)2.345465, "", ""); pqr.NullFlavor = null; Assert.IsTrue(pqr.Validate()); }
public void PQRValueCodeCodeSystem2Test() { Double value = 3.4567; String code = ""; String codesystem = ""; PQR pqr = new PQR((decimal)value, code, codesystem); pqr.NullFlavor = null; Assert.IsTrue(pqr.Validate()); }
public void PQRValueTest() { PQR pqr = new PQR(); pqr.Value = (decimal)4.56323; pqr.Code = null; pqr.CodeSystem = null; pqr.NullFlavor = null; Assert.IsFalse(pqr.Validate()); }
public void PQRNullFlavorTest() { PQR pqr = new PQR(); pqr.Value = null; pqr.Code = null; pqr.NullFlavor = NullFlavor.NoInformation; Assert.IsTrue(pqr.Validate()); }
public void PQRSerializationTest01() { PQR pqr = new PQR(3, "[ft_i]", "2.16.840.1.113883.6.8"); pqr.ValidTimeLow = null; pqr.ValidTimeHigh = null; pqr.ControlActRoot = null; pqr.ControlActExt = null; pqr.NullFlavor = null; pqr.UpdateMode = null; pqr.CodeSystemName = null; pqr.CodeSystemVersion = null; pqr.ValueSet = null; pqr.ValueSetVersion = null; pqr.DisplayName = null; pqr.OriginalText = null; Console.WriteLine("Value: {0} | Code: {1} | Codesystem: {2}", pqr.Value, pqr.Code, pqr.CodeSystem); Assert.IsTrue(pqr.Validate()); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" value=""3"" code=""[ft_i]"" codeSystem=""2.16.840.1.113883.6.8""></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pqr); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void PQRValueNullFlavorTest() { PQR pqr = new PQR(); pqr.Value = (decimal)3.456; pqr.Code = ""; pqr.CodeSystem = ""; pqr.NullFlavor = NullFlavor.NoInformation; Assert.IsFalse(pqr.Validate()); }
public void PQRSerializationTest08() { PQR pqr = new PQR(3, "[ft_i]", "2.16.840.1.113883.6.8"); pqr.ValidTimeLow = new TS(new DateTime(2012, 01, 01), DatePrecision.Day); pqr.ValidTimeHigh = new TS(new DateTime(2012, 12, 31), DatePrecision.Day); pqr.NullFlavor = null; pqr.UpdateMode = UpdateMode.Add; pqr.CodeSystemName = "Fake Name"; pqr.CodeSystemVersion = "1.0"; pqr.ValueSet = "Fake VS"; pqr.ValueSetVersion = "1.0"; pqr.DisplayName = "Fake DN"; pqr.OriginalText = "3 Feet"; Console.WriteLine("Value: {0} | Code: {1} | Codesystem: {2}", pqr.Value, pqr.Code, pqr.CodeSystem); Assert.IsTrue(pqr.Validate()); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" value=""3"" code=""[ft_i]"" codeSystem=""2.16.840.1.113883.6.8"" validTimeHigh=""20121231"" validTimeLow=""20120101"" updateMode=""A"" codeSystemName=""Fake Name"" codeSystemVersion=""1.0"" valueSet=""Fake VS"" valueSetVersion=""1.0""><displayName value=""Fake DN"" language=""en-US"" /><originalText value=""3 Feet"" language=""en-US"" /></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pqr); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
private static IEnumerable<HoneycombDef> GetImageSetForSlice( PQR constant, int constantValue ) { //int i = 8; //int j = 8; for( int i=3; i<=8; i++ ) for( int j=3; j<=8; j++ ) //foreach( Polytope.Projection projection in System.Enum.GetValues( typeof( Polytope.Projection ) ) ) { //if( Geometry2D.GetGeometry( p, q ) != Geometry.Spherical ) // continue; //if( projection == Polytope.Projection.CellCentered ) // continue; /*if( !( Geometry2D.GetGeometry( p, q ) == Geometry.Euclidean || Geometry2D.GetGeometry( q, r ) == Geometry.Euclidean ) ) continue;*/ int p = constant == PQR.P ? constantValue : i; int q = constant == PQR.Q ? constantValue : constant == PQR.P ? i : j; int r = constant == PQR.R ? constantValue : j; // Do the last as infinity System.Func<int, int> iSafe = input => input == 8 ? -1 : input; yield return new HoneycombDef() { P = iSafe( p ), Q = iSafe( q ), R = iSafe( r ), //Projection = projection }; } }
public void PQRParseTest01() { PQR pqr = new PQR(3, "[ft_i]", "2.16.840.1.113883.6.8"); pqr.ValidTimeLow = null; pqr.ValidTimeHigh = null; pqr.ControlActRoot = null; pqr.ControlActExt = null; pqr.NullFlavor = null; pqr.UpdateMode = null; pqr.CodeSystemName = null; pqr.CodeSystemVersion = null; pqr.ValueSet = null; pqr.ValueSetVersion = null; pqr.DisplayName = null; pqr.OriginalText = null; Console.WriteLine("Value: {0} | Code: {1} | Codesystem: {2}", pqr.Value, pqr.Code, pqr.CodeSystem); Assert.IsTrue(pqr.Validate()); // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pqr); var pqr2 = R2SerializationHelper.ParseString<PQR>(actualXml); Assert.AreEqual(pqr, pqr2); }
public void PQRParseTest03() { PQR pqr = new PQR(3, "fakeCode", "fakeCodeSystem"); pqr.NullFlavor = null; pqr.ValidTimeHigh = null; pqr.ValidTimeLow = null; pqr.UpdateMode = null; pqr.OriginalText = null; Console.WriteLine("Value: {0} | Code: {1} | Codesystem: {2}", pqr.Value, pqr.Code, pqr.CodeSystem); Assert.IsTrue(pqr.Validate()); // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pqr); var pqr2 = R2SerializationHelper.ParseString<PQR>(actualXml); Assert.AreEqual(pqr, pqr2); }
public void PQRValueCodeCodeSystemTest() { PQR pqr = new PQR(); pqr.Value = (decimal)3.456; pqr.Code = ""; pqr.CodeSystem = ""; pqr.NullFlavor = null; Assert.IsTrue(pqr.Validate()); }
public void PQRNullTest() { PQR pqr = new PQR(); pqr.Value = null; pqr.Code = null; pqr.NullFlavor = null; Assert.IsFalse(pqr.Validate()); }
public void PQRSerializationTest03() { PQR pqr = new PQR(3, "fakeCode", "fakeCodeSystem"); pqr.NullFlavor = null; pqr.ValidTimeHigh = null; pqr.ValidTimeLow = null; pqr.UpdateMode = null; pqr.OriginalText = null; Console.WriteLine("Value: {0} | Code: {1} | Codesystem: {2}", pqr.Value, pqr.Code, pqr.CodeSystem); Assert.IsTrue(pqr.Validate()); var expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" value=""3"" code=""fakeCode"" codeSystem=""fakeCodeSystem""></test>"; var actualXml = R2SerializationHelper.SerializeAsString(pqr); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void PQRParseTest08() { PQR pqr = new PQR(3, "[ft_i]", "2.16.840.1.113883.6.8"); pqr.ValidTimeLow = new TS(new DateTime(2012, 01, 01), DatePrecision.Day); pqr.ValidTimeHigh = new TS(new DateTime(2012, 12, 31), DatePrecision.Day); pqr.NullFlavor = null; pqr.UpdateMode = UpdateMode.Add; pqr.CodeSystemName = "Fake Name"; pqr.CodeSystemVersion = "1.0"; pqr.ValueSet = "Fake VS"; pqr.ValueSetVersion = "1.0"; pqr.DisplayName = "Fake DN"; pqr.OriginalText = "3 Feet"; Console.WriteLine("Value: {0} | Code: {1} | Codesystem: {2}", pqr.Value, pqr.Code, pqr.CodeSystem); Assert.IsTrue(pqr.Validate()); // serialize and parse pivl var actualXml = R2SerializationHelper.SerializeAsString(pqr); var pqr2 = R2SerializationHelper.ParseString<PQR>(actualXml); Assert.AreEqual(pqr, pqr2); }