diff --git a/src/NHapi.Base/HL7Exception.cs b/src/NHapi.Base/HL7Exception.cs index 954f90608..43f26e853 100644 --- a/src/NHapi.Base/HL7Exception.cs +++ b/src/NHapi.Base/HL7Exception.cs @@ -50,112 +50,112 @@ public class HL7Exception : Exception /// /// Deprecated use instead. [Obsolete("Deprecated use 'AcknowledgementCode.AA' instead.")] - public const int ACK_AA = 1; + public static readonly int ACK_AA = 1; /// /// Acknowledgment Application Error. /// /// Deprecated use instead. [Obsolete("Deprecated use 'AcknowledgementCode.AE' instead.")] - public const int ACK_AE = 2; + public static readonly int ACK_AE = 2; /// /// Acknowledgment Application Reject. /// /// Deprecated use instead. [Obsolete("Deprecated use 'AcknowledgmentCode.AR' instead.")] - public const int ACK_AR = 3; + public static readonly int ACK_AR = 3; /// /// Message accepted. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.MESSAGE_ACCEPTED' instead.")] - public const int MESSAGE_ACCEPTED = 0; + public static readonly int MESSAGE_ACCEPTED; // Default initialised to 0. /// /// Segment sequence error. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.SEGMENT_SEQUENCE_ERROR' instead.")] - public const int SEGMENT_SEQUENCE_ERROR = 100; + public static readonly int SEGMENT_SEQUENCE_ERROR = 100; /// /// Required field missing. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.REQUIRED_FIELD_MISSING' instead.")] - public const int REQUIRED_FIELD_MISSING = 101; + public static readonly int REQUIRED_FIELD_MISSING = 101; /// /// Date type error. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.DATA_TYPE_ERROR' instead.")] - public const int DATA_TYPE_ERROR = 102; + public static readonly int DATA_TYPE_ERROR = 102; /// /// Table value not found. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.TABLE_VALUE_NOT_FOUND' instead.")] - public const int TABLE_VALUE_NOT_FOUND = 103; + public static readonly int TABLE_VALUE_NOT_FOUND = 103; /// /// Unsupported message type. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.UNSUPPORTED_MESSAGE_TYPE' instead.")] - public const int UNSUPPORTED_MESSAGE_TYPE = 200; + public static readonly int UNSUPPORTED_MESSAGE_TYPE = 200; /// /// Unsupported event code. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.UNSUPPORTED_EVENT_CODE' instead.")] - public const int UNSUPPORTED_EVENT_CODE = 201; + public static readonly int UNSUPPORTED_EVENT_CODE = 201; /// /// Unsupported processing id. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.UNSUPPORTED_PROCESSING_ID' instead.")] - public const int UNSUPPORTED_PROCESSING_ID = 202; + public static readonly int UNSUPPORTED_PROCESSING_ID = 202; /// /// Unsupported version id. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.UNSUPPORTED_VERSION_ID' instead.")] - public const int UNSUPPORTED_VERSION_ID = 203; + public static readonly int UNSUPPORTED_VERSION_ID = 203; /// /// Unknown key id. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.UNKNOWN_KEY_IDENTIFIER' instead.")] - public const int UNKNOWN_KEY_IDENTIFIER = 204; + public static readonly int UNKNOWN_KEY_IDENTIFIER = 204; /// /// Duplicate key id. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.DUPLICATE_KEY_IDENTIFIER' instead.")] - public const int DUPLICATE_KEY_IDENTIFIER = 205; + public static readonly int DUPLICATE_KEY_IDENTIFIER = 205; /// /// Application record locked. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.APPLICATION_RECORD_LOCKED' instead.")] - public const int APPLICATION_RECORD_LOCKED = 206; + public static readonly int APPLICATION_RECORD_LOCKED = 206; /// /// Application error. /// /// Deprecated use instead. [Obsolete("Deprecated use 'ErrorCode.APPLICATION_INTERNAL_ERROR' instead.")] - public const int APPLICATION_INTERNAL_ERROR = 207; + public static readonly int APPLICATION_INTERNAL_ERROR = 207; /// Creates an . /// The error message diff --git a/src/NHapi.Base/Parser/PipeParser.cs b/src/NHapi.Base/Parser/PipeParser.cs index bf4c9880a..8c2f4baf3 100644 --- a/src/NHapi.Base/Parser/PipeParser.cs +++ b/src/NHapi.Base/Parser/PipeParser.cs @@ -46,7 +46,7 @@ namespace NHapi.Base.Parser /// Bryan Tripp (bryan_tripp@sourceforge.net). public class PipeParser : ParserBase { - public const string SegmentDelimiter = "\r"; // see section 2.8 of spec + public static readonly string SegmentDelimiter = "\r"; // see section 2.8 of spec private static readonly IHapiLog Log; diff --git a/tests/NHapi.NUnit/ValidationTests.cs b/tests/NHapi.NUnit/ValidationTests.cs index 3e1ec2f99..7444b8b1d 100644 --- a/tests/NHapi.NUnit/ValidationTests.cs +++ b/tests/NHapi.NUnit/ValidationTests.cs @@ -13,7 +13,7 @@ namespace NHapi.NUnit [TestFixture] public class ValidationTests { - public const string MessageSINegativeNumber = + private const string MessageSINegativeNumber = @"MSH|^~\&|XPress Arrival||||200610120839||ORU^R01|EBzH1711114101206|P|2.5.1|||AL|||ASCII PID|1||1711114||Appt^Test||19720501||||||||||||001020006 ORC|||||F @@ -42,35 +42,35 @@ public void TestStrictValidation_NegativeNumber() $"Strict validation should throw a {nameof(DataTypeException)} when parsing a SI field with a negative value"); } - public const string MessageNMAlpha = + private const string MessageNMAlpha = @"MSH|^~\&|XPress Arrival||||200610120839||ORU^R01|EBzH1711114101206|P|2.5.1|||AL|||ASCII PID|1||1711114||Appt^Test||19720501||||||||||||001020006 ORC|||||F OBR|1|||ehipack^eHippa Acknowlegment|||200610120839|||||||||00002^eProvider^Electronic|||||||||F OBX|1|NM|||Hello||||||F"; - public const string MessageNMChar = + private const string MessageNMChar = @"MSH|^~\&|XPress Arrival||||200610120839||ORU^R01|EBzH1711114101206|P|2.5.1|||AL|||ASCII PID|1||1711114||Appt^Test||19720501||||||||||||001020006 ORC|||||F OBR|1|||ehipack^eHippa Acknowlegment|||200610120839|||||||||00002^eProvider^Electronic|||||||||F OBX|1|NM|||!@#$||||||F"; - public const string MessageNMNumber = + private const string MessageNMNumber = @"MSH|^~\&|XPress Arrival||||200610120839||ORU^R01|EBzH1711114101206|P|2.5.1|||AL|||ASCII PID|1||1711114||Appt^Test||19720501||||||||||||001020006 ORC|||||F OBR|1|||ehipack^eHippa Acknowlegment|||200610120839|||||||||00002^eProvider^Electronic|||||||||F OBX|1|NM|||10||||||F"; - public const string MessageNMNegativeNumber = + private const string MessageNMNegativeNumber = @"MSH|^~\&|XPress Arrival||||200610120839||ORU^R01|EBzH1711114101206|P|2.5.1|||AL|||ASCII PID|1||1711114||Appt^Test||19720501||||||||||||001020006 ORC|||||F OBR|1|||ehipack^eHippa Acknowlegment|||200610120839|||||||||00002^eProvider^Electronic|||||||||F OBX|1|NM|||-1||||||F"; - public const string MessageNMDecimal = + private const string MessageNMDecimal = @"MSH|^~\&|XPress Arrival||||200610120839||ORU^R01|EBzH1711114101206|P|2.5.1|||AL|||ASCII PID|1||1711114||Appt^Test||19720501||||||||||||001020006 ORC|||||F