From 454649989d3e3cc1d3cc61ffb5b8f35ead85f1a6 Mon Sep 17 00:00:00 2001 From: Jacob Reimers Date: Thu, 18 Mar 2021 13:09:12 +0100 Subject: [PATCH] Move test data to separate files in TestData/R4. --- ...onServiceTests.cs => PatchServiceTests.cs} | 180 ++---------------- .../Spark.Engine.Test.csproj | 21 ++ .../TestData/R4/collection-add-patch.xml | 27 +++ .../TestData/R4/collection-delete-patch.xml | 13 ++ .../TestData/R4/collection-insert-patch.xml | 23 +++ .../TestData/R4/collection-move-patch.xml | 21 ++ .../TestData/R4/collection-replace-patch.xml | 23 +++ .../TestData/R4/property-assignment-patch.xml | 21 ++ .../TestData/R4/property-replace-patch.xml | 17 ++ 9 files changed, 177 insertions(+), 169 deletions(-) rename src/Spark.Engine.Test/Service/{PatchApplicationServiceTests.cs => PatchServiceTests.cs} (62%) create mode 100644 src/Spark.Engine.Test/TestData/R4/collection-add-patch.xml create mode 100644 src/Spark.Engine.Test/TestData/R4/collection-delete-patch.xml create mode 100644 src/Spark.Engine.Test/TestData/R4/collection-insert-patch.xml create mode 100644 src/Spark.Engine.Test/TestData/R4/collection-move-patch.xml create mode 100644 src/Spark.Engine.Test/TestData/R4/collection-replace-patch.xml create mode 100644 src/Spark.Engine.Test/TestData/R4/property-assignment-patch.xml create mode 100644 src/Spark.Engine.Test/TestData/R4/property-replace-patch.xml diff --git a/src/Spark.Engine.Test/Service/PatchApplicationServiceTests.cs b/src/Spark.Engine.Test/Service/PatchServiceTests.cs similarity index 62% rename from src/Spark.Engine.Test/Service/PatchApplicationServiceTests.cs rename to src/Spark.Engine.Test/Service/PatchServiceTests.cs index 02105403c..31e4d85e2 100644 --- a/src/Spark.Engine.Test/Service/PatchApplicationServiceTests.cs +++ b/src/Spark.Engine.Test/Service/PatchServiceTests.cs @@ -1,5 +1,6 @@ namespace Spark.Engine.Test.Service { + using System.IO; using System.Linq; using System.Reflection; using Engine.Extensions; @@ -7,34 +8,13 @@ using Hl7.Fhir.Model; using Hl7.Fhir.Serialization; using Xunit; - using Task = System.Threading.Tasks.Task; - public class PatchApplicationServiceTests + public class PatchServiceTests { [Fact] public void CanApplyPropertyAssignmentPatch() { - var xml = @" - - - - - - - - - - - - - - - - - - - -"; + var xml = File.ReadAllText(Path.Combine("TestData", "R4", "property-assignment-patch.xml")); var parser = new FhirXmlParser(); var parameters = parser.Parse(xml); @@ -46,29 +26,9 @@ public void CanApplyPropertyAssignmentPatch() } [Fact] - public async System.Threading.Tasks.Task WhenApplyingPropertyAssignmentPatchToNonEmptyPropertyThenThrows() + public void WhenApplyingPropertyAssignmentPatchToNonEmptyPropertyThenThrows() { - var xml = @" - - - - - - - - - - - - - - - - - - - -"; + var xml = File.ReadAllText(Path.Combine("TestData", "R4", "property-assignment-patch.xml")); var parser = new FhirXmlParser(); var parameters = parser.Parse(xml); @@ -81,33 +41,7 @@ public async System.Threading.Tasks.Task WhenApplyingPropertyAssignmentPatchToNo [Fact] public void CanApplyCollectionAddPatch() { - var xml = @" - - - - - - - - - - - - - - - - - - - - - - - - - -"; + var xml = File.ReadAllText(Path.Combine("TestData", "R4", "collection-add-patch.xml")); var parser = new FhirXmlParser(); var parameters = parser.Parse(xml); @@ -122,29 +56,7 @@ public void CanApplyCollectionAddPatch() [Fact] public void CanApplyCollectionReplacePatch() { - var xml = @" - - - - - - - - - - - - - - - - - - - - - -"; + var xml = File.ReadAllText(Path.Combine("TestData", "R4", "collection-replace-patch.xml")); var parser = new FhirXmlParser(); var parameters = parser.Parse(xml); @@ -236,29 +148,7 @@ public void CanApplyCreatedDiffPatch() [Fact] public void CanApplyCollectionInsertPatch() { - var xml = @" - - - - - - - - - - - - - - - - - - - - - -"; + var xml = File.ReadAllText(Path.Combine("TestData", "R4", "collection-insert-patch.xml")); var parser = new FhirXmlParser(); var parameters = parser.Parse(xml); @@ -280,27 +170,7 @@ public void CanApplyCollectionInsertPatch() [Fact] public void CanApplyCollectionMovePatch() { - var xml = @" - - - - - - - - - - - - - - - - - - - -"; + var xml = File.ReadAllText(Path.Combine("TestData", "R4", "collection-move-patch.xml")); var parser = new FhirXmlParser(); var parameters = parser.Parse(xml); @@ -326,23 +196,7 @@ public void CanApplyCollectionMovePatch() [Fact] public void CanApplyPropertyReplacementPatch() { - var xml = @" - - - - - - - - - - - - - - - -"; + var xml = File.ReadAllText(Path.Combine("TestData", "R4", "property-replace-patch.xml")); var parser = new FhirXmlParser(); var parameters = parser.Parse(xml); @@ -356,19 +210,7 @@ public void CanApplyPropertyReplacementPatch() [Fact] public void CanApplyCollectionDeletePatch() { - var xml = @" - - - - - - - - - - - -"; + var xml = File.ReadAllText(Path.Combine("TestData", "R4", "collection-delete-patch.xml")); var parser = new FhirXmlParser(); var parameters = parser.Parse(xml); diff --git a/src/Spark.Engine.Test/Spark.Engine.Test.csproj b/src/Spark.Engine.Test/Spark.Engine.Test.csproj index c64fb83da..3c6357bb2 100644 --- a/src/Spark.Engine.Test/Spark.Engine.Test.csproj +++ b/src/Spark.Engine.Test/Spark.Engine.Test.csproj @@ -51,12 +51,33 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest PreserveNewest + + PreserveNewest + + + PreserveNewest + \ No newline at end of file diff --git a/src/Spark.Engine.Test/TestData/R4/collection-add-patch.xml b/src/Spark.Engine.Test/TestData/R4/collection-add-patch.xml new file mode 100644 index 000000000..cf621c9a6 --- /dev/null +++ b/src/Spark.Engine.Test/TestData/R4/collection-add-patch.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Spark.Engine.Test/TestData/R4/collection-delete-patch.xml b/src/Spark.Engine.Test/TestData/R4/collection-delete-patch.xml new file mode 100644 index 000000000..d0d849b39 --- /dev/null +++ b/src/Spark.Engine.Test/TestData/R4/collection-delete-patch.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Spark.Engine.Test/TestData/R4/collection-insert-patch.xml b/src/Spark.Engine.Test/TestData/R4/collection-insert-patch.xml new file mode 100644 index 000000000..2f053ced8 --- /dev/null +++ b/src/Spark.Engine.Test/TestData/R4/collection-insert-patch.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Spark.Engine.Test/TestData/R4/collection-move-patch.xml b/src/Spark.Engine.Test/TestData/R4/collection-move-patch.xml new file mode 100644 index 000000000..71e70ede7 --- /dev/null +++ b/src/Spark.Engine.Test/TestData/R4/collection-move-patch.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Spark.Engine.Test/TestData/R4/collection-replace-patch.xml b/src/Spark.Engine.Test/TestData/R4/collection-replace-patch.xml new file mode 100644 index 000000000..9c2c949ca --- /dev/null +++ b/src/Spark.Engine.Test/TestData/R4/collection-replace-patch.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Spark.Engine.Test/TestData/R4/property-assignment-patch.xml b/src/Spark.Engine.Test/TestData/R4/property-assignment-patch.xml new file mode 100644 index 000000000..c36af64fa --- /dev/null +++ b/src/Spark.Engine.Test/TestData/R4/property-assignment-patch.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Spark.Engine.Test/TestData/R4/property-replace-patch.xml b/src/Spark.Engine.Test/TestData/R4/property-replace-patch.xml new file mode 100644 index 000000000..8bd17ee36 --- /dev/null +++ b/src/Spark.Engine.Test/TestData/R4/property-replace-patch.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file