diff --git a/Geodatenbezug.Test/Geodatenbezug.Test.csproj b/Geodatenbezug.Test/Geodatenbezug.Test.csproj
index a2f1f1d..6adc12d 100644
--- a/Geodatenbezug.Test/Geodatenbezug.Test.csproj
+++ b/Geodatenbezug.Test/Geodatenbezug.Test.csproj
@@ -51,10 +51,25 @@
PreserveNewest
-
+
PreserveNewest
-
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
PreserveNewest
diff --git a/Geodatenbezug.Test/Processors/GeometryTest.cs b/Geodatenbezug.Test/Processors/GeometryTest.cs
new file mode 100644
index 0000000..a353e27
--- /dev/null
+++ b/Geodatenbezug.Test/Processors/GeometryTest.cs
@@ -0,0 +1,141 @@
+using Geodatenbezug.Models;
+using Microsoft.Extensions.Logging;
+using Moq;
+using OSGeo.OGR;
+
+namespace Geodatenbezug.Processors;
+
+[TestClass]
+[DeploymentItem("testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_donut_valid_polygon.gpkg", "testdata")]
+[DeploymentItem("testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_wo_donut.gpkg", "testdata")]
+[DeploymentItem("testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_donut_invalid_polygon.gpkg", "testdata")]
+[DeploymentItem("testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_w_donut.gpkg", "testdata")]
+[DeploymentItem("testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_wo_donut.gpkg", "testdata")]
+[DeploymentItem("testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_singlepart_donut.gpkg", "testdata")]
+[DeploymentItem("testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_singlepart_donut.gpkg", "testdata")]
+public class GeometryTest
+{
+ private readonly Topic topic = new()
+ {
+ TopicTitle = BaseTopic.lwb_perimeter_ln_sf.GetDescription(),
+ Canton = Canton.NE,
+ BaseTopic = BaseTopic.lwb_perimeter_ln_sf,
+ UpdatedAt = DateTime.Now,
+ };
+
+ private Mock> loggerMock;
+ private Mock geodiensteApiMock;
+ private Mock azureStorageMock;
+ private PerimeterLnSfProcessor processor;
+
+ [TestInitialize]
+ public void Initialize()
+ {
+ loggerMock = new Mock>(MockBehavior.Strict);
+ geodiensteApiMock = new Mock(MockBehavior.Strict);
+ azureStorageMock = new Mock(MockBehavior.Strict);
+ processor = new PerimeterLnSfProcessor(geodiensteApiMock.Object, azureStorageMock.Object, loggerMock.Object, topic);
+ }
+
+ [TestCleanup]
+ public void Cleanup()
+ {
+ loggerMock.VerifyAll();
+ }
+
+ [TestMethod]
+ public async Task RunGdalProcessingAsyncValidMultiPartWithoutDonut()
+ {
+ loggerMock.Setup(LogLevel.Information, $"Starte GDAL-Prozessierung");
+
+ processor.InputDataPath = "testdata\\lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_wo_donut.gpkg";
+ await processor.RunGdalProcessingAsync();
+
+ var layerName = "perimeter_ln_sf";
+
+ var inputSource = Ogr.Open(processor.InputDataPath, 0);
+ var inputLayer = inputSource.GetLayerByName(layerName);
+
+ var resultSource = Ogr.Open(processor.InputDataPath.Replace(".gpkg", ".gdb", StringComparison.InvariantCulture), 0);
+ var resultLayer = resultSource.GetLayerByName(layerName);
+
+ Assert.AreEqual(1, inputLayer.GetFeatureCount(0));
+ Assert.AreEqual(2, resultLayer.GetFeatureCount(0));
+ }
+
+ [TestMethod]
+ public async Task RunGdalProcessingAsyncInvalidMultiPartWithoutDonut()
+ {
+ loggerMock.Setup(LogLevel.Information, $"Starte GDAL-Prozessierung");
+
+ processor.InputDataPath = "testdata\\lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_wo_donut.gpkg";
+ await Assert.ThrowsExceptionAsync(processor.RunGdalProcessingAsync);
+ }
+
+ [TestMethod]
+ public async Task RunGdalProcessingAsyncValidMultiPartWithDonuts()
+ {
+ loggerMock.Setup(LogLevel.Information, $"Starte GDAL-Prozessierung");
+
+ processor.InputDataPath = "testdata\\lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_w_donut.gpkg";
+ await processor.RunGdalProcessingAsync();
+
+ var layerName = "perimeter_ln_sf";
+
+ var inputSource = Ogr.Open(processor.InputDataPath, 0);
+ var inputLayer = inputSource.GetLayerByName(layerName);
+
+ var resultSource = Ogr.Open(processor.InputDataPath.Replace(".gpkg", ".gdb", StringComparison.InvariantCulture), 0);
+ var resultLayer = resultSource.GetLayerByName(layerName);
+
+ Assert.AreEqual(2, inputLayer.GetFeatureCount(0));
+ Assert.AreEqual(3, resultLayer.GetFeatureCount(0));
+ }
+
+ [TestMethod]
+ public async Task RunGdalProcessingAsyncValidSinglePartDonut()
+ {
+ loggerMock.Setup(LogLevel.Information, $"Starte GDAL-Prozessierung");
+
+ processor.InputDataPath = "testdata\\lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_singlepart_donut.gpkg";
+ await processor.RunGdalProcessingAsync();
+
+ var layerName = "perimeter_ln_sf";
+
+ var inputSource = Ogr.Open(processor.InputDataPath, 0);
+ var inputLayer = inputSource.GetLayerByName(layerName);
+
+ var resultSource = Ogr.Open(processor.InputDataPath.Replace(".gpkg", ".gdb", StringComparison.InvariantCulture), 0);
+ var resultLayer = resultSource.GetLayerByName(layerName);
+
+ Assert.AreEqual(1, inputLayer.GetFeatureCount(0));
+ Assert.AreEqual(1, resultLayer.GetFeatureCount(0));
+ }
+
+ [TestMethod]
+ public async Task RunGdalProcessingAsyncInvalidSinglePartDonut()
+ {
+ loggerMock.Setup(LogLevel.Information, $"Starte GDAL-Prozessierung");
+
+ processor.InputDataPath = "testdata\\lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_singlepart_donut.gpkg";
+ await Assert.ThrowsExceptionAsync(processor.RunGdalProcessingAsync);
+ }
+
+ [TestMethod]
+ public async Task RunGdalProcessingAsyncInvalidDonutValidPolygon()
+ {
+ loggerMock.Setup(LogLevel.Information, $"Starte GDAL-Prozessierung");
+
+ processor.InputDataPath = "testdata\\lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_donut_valid_polygon.gpkg";
+ await Assert.ThrowsExceptionAsync(processor.RunGdalProcessingAsync);
+ }
+
+ [TestMethod]
+ public async Task RunGdalProcessingAsyncValidDonutInvalidPolygon()
+ {
+ loggerMock.Setup(LogLevel.Information, $"Starte GDAL-Prozessierung");
+
+ processor.InputDataPath = "testdata\\lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_donut_invalid_polygon.gpkg";
+ await Assert.ThrowsExceptionAsync(processor.RunGdalProcessingAsync);
+ }
+}
diff --git a/Geodatenbezug.Test/Processors/PerimeterLnSfProcessorTest.cs b/Geodatenbezug.Test/Processors/PerimeterLnSfProcessorTest.cs
index 5f2046d..07b0ec1 100644
--- a/Geodatenbezug.Test/Processors/PerimeterLnSfProcessorTest.cs
+++ b/Geodatenbezug.Test/Processors/PerimeterLnSfProcessorTest.cs
@@ -7,8 +7,6 @@ namespace Geodatenbezug.Processors;
[TestClass]
[DeploymentItem("testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten.gpkg", "testdata")]
-[DeploymentItem("testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_donut.gpkg", "testdata")]
-[DeploymentItem("testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_geometry.gpkg", "testdata")]
public class PerimeterLnSfProcessorTest
{
private readonly Topic topic = new ()
@@ -84,37 +82,4 @@ public async Task RunGdalProcessingAsync()
Assert.AreEqual(firstInputFeature.GetFieldAsString("kanton"), firstResultFeature.GetFieldAsString("kanton"));
GdalAssert.AssertGeometry(firstInputFeature, firstResultFeature);
}
-
- [TestMethod]
- public async Task RunGdalProcessingAsyncValidDonutGeometry()
- {
- loggerMock.Setup(LogLevel.Information, $"Starte GDAL-Prozessierung");
-
- processor.InputDataPath = "testdata\\lwb_perimeter_ln_sf_v2_0_lv95_testdaten_donut.gpkg";
- await processor.RunGdalProcessingAsync();
-
- var layerName = "perimeter_ln_sf";
-
- var inputSource = Ogr.Open(processor.InputDataPath, 0);
- var inputLayer = inputSource.GetLayerByName(layerName);
-
- var resultSource = Ogr.Open(processor.InputDataPath.Replace(".gpkg", ".gdb", StringComparison.InvariantCulture), 0);
- var resultLayer = resultSource.GetLayerByName(layerName);
-
- Assert.AreEqual(1, inputLayer.GetFeatureCount(0));
- Assert.AreEqual(1, resultLayer.GetFeatureCount(0));
-
- var firstInputFeature = inputLayer.GetNextFeature();
- var firstResultFeature = resultLayer.GetNextFeature();
- GdalAssert.AssertGeometry(firstInputFeature, firstResultFeature);
- }
-
- [TestMethod]
- public async Task RunGdalProcessingAsyncInvalidGeometry()
- {
- loggerMock.Setup(LogLevel.Information, $"Starte GDAL-Prozessierung");
-
- processor.InputDataPath = "testdata\\lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_geometry.gpkg";
- await Assert.ThrowsExceptionAsync(processor.RunGdalProcessingAsync);
- }
}
diff --git a/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_donut_valid_polygon.gpkg b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_donut_valid_polygon.gpkg
new file mode 100644
index 0000000..53d9f9b
Binary files /dev/null and b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_donut_valid_polygon.gpkg differ
diff --git a/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_singlepart_donut.gpkg b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_singlepart_donut.gpkg
new file mode 100644
index 0000000..8a2f54e
Binary files /dev/null and b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_singlepart_donut.gpkg differ
diff --git a/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_geometry.gpkg b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_wo_donut.gpkg
similarity index 97%
rename from Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_geometry.gpkg
rename to Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_wo_donut.gpkg
index 6760af9..b22d2b6 100644
Binary files a/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_geometry.gpkg and b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_invalid_wo_donut.gpkg differ
diff --git a/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_donut_invalid_polygon.gpkg b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_donut_invalid_polygon.gpkg
new file mode 100644
index 0000000..dc44483
Binary files /dev/null and b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_donut_invalid_polygon.gpkg differ
diff --git a/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_donut.gpkg b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_singlepart_donut.gpkg
similarity index 100%
rename from Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_donut.gpkg
rename to Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_singlepart_donut.gpkg
diff --git a/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_w_donut.gpkg b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_w_donut.gpkg
new file mode 100644
index 0000000..9c9eaf4
Binary files /dev/null and b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_w_donut.gpkg differ
diff --git a/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_wo_donut.gpkg b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_wo_donut.gpkg
new file mode 100644
index 0000000..9bf44cb
Binary files /dev/null and b/Geodatenbezug.Test/testdata/lwb_perimeter_ln_sf_v2_0_lv95_testdaten_valid_wo_donut.gpkg differ