Skip to content

Commit

Permalink
Add unit test for #51
Browse files Browse the repository at this point in the history
  • Loading branch information
milkshakeuk committed Apr 15, 2021
1 parent 0a71e31 commit 9354448
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/NHapi.NUnit/Parser/PipeParserUnexpectedSegmentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

using NHapi.Base.Parser;

/// <summary>
/// Fixes https://github.com/nHapiNET/nHapi/issues/101.
/// </summary>
public class PipeParserUnexpectedSegmentTests
{
#region v23
Expand Down Expand Up @@ -143,6 +146,33 @@ public void Parse_V25_ORM_O01_WithCustomEvnSegment()

#region v251

/// <summary>
/// fixes https://github.com/nHapiNET/nHapi/issues/51.
/// </summary>
[Test]
public void Parse_V251_RDE_O11()
{
var message =
"MSH|^~\\&|EXACTDATA||ALL|ALL|20101217181500||RDE^O11^RDE_O11|EF010000000071000000_4|T^T|2.5.1\r"
+ "PID|1||7010566270^^^^DODID~EM010000008000000^^^^MR||ZZEDConner^Dean^J^^Mr.||19810611|MALE||WHITE^^HL70005|^^^^^USA^H||||ENGLISH^^HL70296|SINGLE^^HL70002||EF010000000071000000||||NOTHISPANICORLATINO^^HL70189|||||ACTIVEDUTY^^HL70172\r"
+ "PV1|1|OUTPATIENT|^^^MBCC^^AMBLOC||||1853210951^Pennington^Zachary|||MEDICINEGENERAL|||||||1853210951^Pennington^Zachary|||||||||||||||||||01|||||ACTIVE|||20101217181500|20101217184500||||||V\r"
+ "PV2|||V70.0^General medical examination^I9C|||||||||||||||||||||||||||||||||||||||||N\r"
+ "AL1|1|DRUG^^HL70127|70618^Penicillin^RXNORM|MODERATE^^HL70128|Dry Mouth|20100928\r"
+ "ORC|NW|101217-833651^ExD|||ORDERED\r"
+ "RXE|^^^20101217184500|54569-4888-0^Oseltamivir|1||75 mg||^po bid x 5d||N|10||0||||||||||||||||||||20101217184500\r"
+ "RXR|^Oral^HL70162";

var parser = new PipeParser();

var result = parser.Parse(message);

var rdeO11 = result as NHapi.Model.V251.Message.RDE_O11;

Assert.IsNotNull(rdeO11);
Assert.AreEqual("Oral", rdeO11.GetORDER().GetRXR().Route.Text.Value);
Assert.AreEqual("HL70162", rdeO11.GetORDER().GetRXR().Route.NameOfCodingSystem.Value);
}

[Test]
public void Parse_V251_ORM_O01()
{
Expand Down

0 comments on commit 9354448

Please sign in to comment.