public void WriteReferenceLine_NullReferenceLine_ThrowArgumentNullException() { // Setup string filePath = TestHelper.GetScratchPadPath(Path.Combine(nameof(WriteReferenceLine_NullReferenceLine_ThrowArgumentNullException), "test.shp")); var writer = new ReferenceLineWriter(); // Call TestDelegate call = () => writer.WriteReferenceLine(null, "anId", filePath); // Assert Assert.Throws <ArgumentNullException>(call); }
public void WriteReferenceLine_NullFilePath_ThrowArgumentNullException() { // Setup var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] { new Point2D(1.1, 2.2), new Point2D(11.11, 22.22) }); var writer = new ReferenceLineWriter(); // Call TestDelegate call = () => writer.WriteReferenceLine(referenceLine, "anId", null); // Assert Assert.Throws <ArgumentNullException>(call); }
public void WriteReferenceLine_InvalidId_ThrowArgumentException(string id) { // Setup var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] { new Point2D(1.1, 2.2), new Point2D(11.11, 22.22) }); string filePath = TestHelper.GetScratchPadPath(Path.Combine(nameof(WriteReferenceLine_InvalidId_ThrowArgumentException), "test.shp")); var writer = new ReferenceLineWriter(); // Call TestDelegate call = () => writer.WriteReferenceLine(referenceLine, id, filePath); // Assert Assert.Throws <ArgumentException>(call); }
public void WriteReferenceLine_ValidData_WritesShapeFile() { // Setup var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] { new Point2D(1.1, 2.2), new Point2D(11.11, 22.22) }); string directoryPath = TestHelper.GetScratchPadPath(nameof(WriteReferenceLine_ValidData_WritesShapeFile)); using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(WriteReferenceLine_ValidData_WritesShapeFile))) { Directory.CreateDirectory(directoryPath); string filePath = Path.Combine(directoryPath, "test.shp"); const string baseName = "test"; var writer = new ReferenceLineWriter(); // Precondition FileTestHelper.AssertEssentialShapefilesExist(directoryPath, baseName, false); // Call writer.WriteReferenceLine(referenceLine, "anId", filePath); // Assert FileTestHelper.AssertEssentialShapefilesExist(directoryPath, baseName, true); FileTestHelper.AssertEssentialShapefileMd5Hashes(directoryPath, baseName, TestHelper.GetTestDataPath(TestDataPath.Riskeer.Common.IO), "LineShapefileMd5", 88, 8, 289); } }