public void ReadByGeoFilter_ReadWithRectangleMBRPartiallyInBoundsAndFlagSetToTrue_ShouldReturnNoGeometries() { Envelope boundsWithWholeTriangle = new Envelope(-1.17459, -1.00231, -1.09803, -0.80861); // Arrange. m_TempFiles = new TempFileWriter[] { new TempFileWriter("test.shp", ShpFiles.Read("UnifiedChecksMaterial")), new TempFileWriter("test.dbf", DbfFiles.Read("UnifiedChecksMaterial")), }; m_shapeDataReader = new ShapeDataReader(m_TempFiles[0].Path); // Act. IEnumerable <IShapefileFeature> results = m_shapeDataReader.ReadByMBRFilter(boundsWithWholeTriangle, true); // Assert. Assert.IsNotNull(results); Assert.IsFalse(results.Any()); }
public void ReadByGeoFilter_ReadWithNoShapeInBounds_ShouldReturnEmptyEnumerable() { Envelope boundsWithWholeTriangle = new Envelope(-1.17459, -1.00231, -1.09803, -1.5); // Arrange. m_TempFiles = new TempFileWriter[] { new TempFileWriter("test.shp", ShpFiles.Read("UnifiedChecksMaterial")), new TempFileWriter("test.dbf", DbfFiles.Read("UnifiedChecksMaterial")), }; m_shapeDataReader = new ShapeDataReader(m_TempFiles[0].Path); // Act. IEnumerable <IShapefileFeature> results = m_shapeDataReader.ReadByMBRFilter(boundsWithWholeTriangle); // Assert. Assert.IsNotNull(results); Assert.IsFalse(results.Any()); }
public void ForEachIteration_ReadEntryValues_ShoudReturnCorrectValues() { // Arrange m_TmpFile = new TempFileWriter("data.dbf", DbfFiles.Read("point_ed50_geo")); m_Reader = new DbaseReader(m_TmpFile.Path); var expectedTable = new { Ids = new double[] { 3, 2, 1 }, Strings = new string[] { "str3", "str2", "str1" }, WholeNums = new double[] { 3, 2, 1 }, DecNums = new double[] { 3, 2, 1 }, }; // Act. IAttributesTable[] results = m_Reader.ToArray(); Assert.AreEqual(results.Length, 3); // Assert. int currResIndex = 0; foreach (IAttributesTable res in results) { object id = res["id"]; object str = res["str"]; object wholeNum = res["wholeNum"]; object decNum = res["decNum"]; object date = res["dt"]; Assert.IsNotNull(id); Assert.IsNotNull(str); Assert.IsNotNull(wholeNum); Assert.IsNotNull(decNum); Assert.IsNotNull(date); Assert.IsInstanceOf <double>(id); Assert.IsInstanceOf <string>(str); Assert.IsInstanceOf <double>(wholeNum); Assert.IsInstanceOf <double>(decNum); Assert.IsInstanceOf <DateTime>(date); Assert.AreEqual(id, expectedTable.Ids[currResIndex]); Assert.AreEqual(str, expectedTable.Strings[currResIndex]); Assert.AreEqual(wholeNum, expectedTable.WholeNums[currResIndex]); Assert.AreEqual(decNum, expectedTable.DecNums[currResIndex]); Assert.AreEqual(date, DATE_SAVED_IN_DBF); currResIndex++; } }