public void ReadByGeoFilter_ReadShapeDataAfterReaderObjectDisposed_ShouldThrowException() { Envelope boundsWithWholeTriangle = new Envelope(-1.17459, -1.00231, -1.09803, -0.80861); // Arrange. m_TempFiles = new TempFileWriter[] { new TempFileWriter(".shp", ShpFiles.Read("UnifiedChecksMaterial")), new TempFileWriter(".dbf", DbfFiles.Read("UnifiedChecksMaterial")), }; m_shapeDataReader = new ShapeDataReader(m_TempFiles[0].Path); // Act. IEnumerable <IShapefileFeature> results = m_shapeDataReader.ReadByMBRFilter(boundsWithWholeTriangle); // Assert. Assert.IsNotNull(results); IShapefileFeature result = results.Single(); // Dispose of the reader object. m_shapeDataReader.Dispose(); // Try reading dbf data. Assert.Catch <InvalidOperationException>(() => { IGeometry table = result.Geometry; }); }
public void ReadByGeoFilter_ReadShapeDataAfterReaderObjectDisposed_ShouldThrowException() { Envelope boundsWithWholeTriangle = new Envelope(-1.17459, -1.00231, -1.09803, -0.80861); // Arrange. m_TempFiles = new TempFileCloudUploader[] { new TempFileCloudUploader("test.shp", ShpFiles.Read("UnifiedChecksMaterial")), new TempFileCloudUploader("test.dbf", DbfFiles.Read("UnifiedChecksMaterial")), }; m_shapeDataReader = new ShapeDataReader(new ShapefileStreamProviderRegistry(GetProvider(m_TempFiles[0].Path), GetProvider(m_TempFiles[1].Path))); // Act. IEnumerable <IShapefileFeature> results = m_shapeDataReader.ReadByMBRFilter(boundsWithWholeTriangle); // Assert. Assert.IsNotNull(results); IShapefileFeature result = results.Single(); // Dispose of the reader object. m_shapeDataReader.Dispose(); // Try reading dbf data. IGeometry table = result.Geometry; }
public void TestCleanup() { if (m_shapeDataReader != null) { m_shapeDataReader.Dispose(); m_shapeDataReader = null; } if (m_TempFiles != null) { foreach (TempFileWriter tempFile in m_TempFiles) { tempFile.Dispose(); } m_TempFiles = null; } }