forked from phatboyg/Machete
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
failing unit test for issue phatboyg#58 with condition logic in place
fixed test issue add more conditions to X12 maps added conditional logic to several X12 maps created more conditions in maps and created failing unit test for issue phatboyg#65 added new failing test for issue phatboyg#65 updated readme and added tests for issue phatboyg#65 fixed gitter link added appveyor badge added nuget version badge added appveyor test status badge added appveyor test status badge added appveyor test status badge modified the readme added license section to readme modified readme added more stuff to readme modified readme modified readme modified readme and tests updated tests and readme added tests for X12 added more X12 tests fixed issue phatboyg#68 and added tests fixed issue phatboyg#69 and added more X12 parsing tests added more tests and fixed some X12 schema issues
- Loading branch information
Showing
138 changed files
with
10,912 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Default ignored files | ||
/.idea/shelf/ | ||
/.idea/workspace.xml | ||
|
||
# Datasource local storage ignored files | ||
/.idea/.idea.Machete/.idea/dataSources/ | ||
dataSources.local.xml | ||
|
||
# Editor-based HTTP Client requests | ||
/.idea/httpRequests/ | ||
rest-client.private.env.json | ||
http-client.private.env.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Machete.HL7.Tests/QueryTests/FirstOrDefaultQueryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
namespace Machete.HL7.Tests.QueryTests | ||
{ | ||
using NUnit.Framework; | ||
using Testing; | ||
using TestSchema; | ||
|
||
|
||
[TestFixture] | ||
public class FirstOrDefaultQueryTests : | ||
HL7MacheteTestHarness<TestHL7Entity, HL7Entity> | ||
{ | ||
[Test] | ||
public void Test() | ||
{ | ||
const string message = @"MSH|^~\&|MACHETELAB|^DOSC|MACHETE|18779|20130405125146269||ORM^O01|1999077678|P|2.3|||AL|AL | ||
PID|1|000000000026|60043^^^MACHETE^MRN||MACHETE^JOE||19890909|F|||123 SEASAME STREET^^Oakland^CA^94600||5101234567|5101234567||||||||||||||||N | ||
VL1|a~b~c | ||
VL1|d~e~f | ||
VL1|g~h~i | ||
VL1|j~k~l | ||
VL1|m~n~o | ||
VL1|p~q~r | ||
VL1|s~t~u | ||
VL1|v~w~x | ||
VL1|y~z"; | ||
|
||
var parse = Parser.Parse(message); | ||
|
||
var result = parse.Query(q => | ||
from msh in q.Select<MSHSegment>() | ||
from pid in q.Select<PIDSegment>() | ||
from vls in q.Select<ValueListSegment>().ZeroOrMore().FirstOrDefault() | ||
select vls); | ||
|
||
Assert.IsTrue(result.HasResult); | ||
|
||
int count = result.Select(x => x.RepeatedString).Count(); | ||
|
||
Assert.AreEqual(3, count); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace Machete.HL7.Tests.QueryTests | ||
{ | ||
using NUnit.Framework; | ||
using Testing; | ||
using TestSchema; | ||
|
||
|
||
[TestFixture] | ||
public class SelectManyQueryTests : | ||
HL7MacheteTestHarness<TestHL7Entity, HL7Entity> | ||
{ | ||
[Test] | ||
public void Test() | ||
{ | ||
const string message = @"MSH|^~\&|MACHETELAB|^DOSC|MACHETE|18779|20130405125146269||ORM^O01|1999077678|P|2.3|||AL|AL | ||
PID|1|000000000026|60043^^^MACHETE^MRN||MACHETE^JOE||19890909|F|||123 SEASAME STREET^^Oakland^CA^94600||5101234567|5101234567||||||||||||||||N | ||
VL1|a~b~c | ||
VL1|d~e~f | ||
VL1|g~h~i | ||
VL1|j~k~l | ||
VL1|m~n~o | ||
VL1|p~q~r | ||
VL1|s~t~u | ||
VL1|v~w~x | ||
VL1|y~z"; | ||
|
||
var parse = Parser.Parse(message); | ||
|
||
// var result = parse.Query(q => from msh in q.Select<MSHSegment>() | ||
// from pid in q.Select<PIDSegment>() | ||
// from vls in q.Select<ValueListSegment>().SelectMany(q.Select<ValueListSegment>(), x => x.RepeatedString).ZeroOrMore()) | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Machete.HL7.Tests/QueryTests/SingleOrDefaultQueryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace Machete.HL7.Tests.QueryTests | ||
{ | ||
using NUnit.Framework; | ||
using Testing; | ||
using TestSchema; | ||
|
||
|
||
[TestFixture] | ||
public class SingleOrDefaultQueryTests : | ||
HL7MacheteTestHarness<TestHL7Entity, HL7Entity> | ||
{ | ||
[Test] | ||
public void Test() | ||
{ | ||
const string message = @"MSH|^~\&|MACHETELAB|^DOSC|MACHETE|18779|20130405125146269||ORM^O01|1999077678|P|2.3|||AL|AL | ||
PID|1|000000000026|60043^^^MACHETE^MRN||MACHETE^JOE||19890909|F|||123 SEASAME STREET^^Oakland^CA^94600||5101234567|5101234567||||||||||||||||N | ||
VL1|a~b~c"; | ||
|
||
var parse = Parser.Parse(message); | ||
|
||
var result = parse.Query(q => | ||
from msh in q.Select<MSHSegment>() | ||
from pid in q.Select<PIDSegment>() | ||
from vls in q.Select<ValueListSegment>().ZeroOrMore().SingleOrDefault() | ||
select vls); | ||
|
||
Assert.IsTrue(result.HasResult); | ||
|
||
int count = result.Select(x => x.RepeatedString).Count(); | ||
|
||
Assert.AreEqual(3, count); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Machete.HL7.Tests.TestSchema | ||
{ | ||
public interface CNEComponent : | ||
HL7Component | ||
{ | ||
Value<string> Identifier { get; } | ||
Value<string> Text { get; } | ||
Value<string> NameOfCodingSystem { get; } | ||
Value<string> AlternateIdentifier { get; } | ||
Value<string> AlternateText { get; } | ||
Value<string> NameOfAlternateCodingSystem { get; } | ||
Value<string> CodingSystemVersionId { get; } | ||
Value<string> AlternateCodingSystemVersionId { get; } | ||
Value<string> OriginalText { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Machete.HL7.Tests.TestSchema | ||
{ | ||
public class CNEComponentMap : | ||
HL7ComponentMap<CNEComponent, HL7Component> | ||
{ | ||
public CNEComponentMap() | ||
{ | ||
Value(x => x.Identifier, 0); | ||
Value(x => x.Text, 1); | ||
Value(x => x.NameOfCodingSystem, 2); | ||
Value(x => x.AlternateIdentifier, 3); | ||
Value(x => x.AlternateText, 4); | ||
Value(x => x.NameOfAlternateCodingSystem, 5); | ||
Value(x => x.CodingSystemVersionId, 6); | ||
Value(x => x.AlternateCodingSystemVersionId, 7); | ||
Value(x => x.OriginalText, 8); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Machete.HL7.Tests.TestSchema | ||
{ | ||
using System; | ||
|
||
|
||
public interface MSASegment : | ||
HL7Segment | ||
{ | ||
Value<string> AcknowledgmentCode { get; } | ||
Value<string> MessageControlId { get; } | ||
Value<string> TextMessage { get; } | ||
Value<decimal> ExpectedSequenceNumber { get; } | ||
Value<DateTimeOffset> DelayedAcknowledgmentType { get; } | ||
Value<CNEComponent> ErrorCondition { get; } | ||
Value<decimal> MessageWaitingNumber { get; } | ||
Value<string> MessageWaitingPriority { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace Machete.HL7.Tests.TestSchema | ||
{ | ||
public class MSASegmentMap : | ||
HL7SegmentMap<MSASegment, HL7Entity> | ||
{ | ||
public MSASegmentMap() | ||
{ | ||
Id = "MSA"; | ||
|
||
Name = "Message Acknowledgment"; | ||
|
||
Value(x => x.AcknowledgmentCode, 1, x => x.IsRequired()); | ||
Value(x => x.MessageControlId, 2, x => x.IsRequired()); | ||
Value(x => x.TextMessage, 3); | ||
Value(x => x.ExpectedSequenceNumber, 4); | ||
Value(x => x.DelayedAcknowledgmentType, 5, x => {x.Converter = HL7ValueConverters.VariableLongDateTime;}); | ||
Entity(x => x.ErrorCondition, 6); | ||
Value(x => x.MessageWaitingNumber, 7); | ||
Value(x => x.MessageWaitingPriority, 8); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.