public void ReadShapeAtOffset_ReadPolygon_shouldReturnCorrectValue() { // Arrange. IGeometryFactory factory = new GeometryFactory(); m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("polygon_ed50_geo")); m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path); long[] shapeOffsets = { 100, 252 }; Coordinate[,] expectedLines = new Coordinate[,] { { new Coordinate(33.719047819505683, 31.989469320254013), new Coordinate(33.730049025918099, 32.025301664150398), new Coordinate(33.771538712027194, 32.008956957757299), new Coordinate(33.78096814177016, 31.993555297099103), new Coordinate(33.744507207486457, 31.928805665809271), new Coordinate(33.719047819505683, 31.989469320254013) }, { new Coordinate(33.821829475819285, 32.051075573685317), new Coordinate(33.860176141775888, 32.072449163771559), new Coordinate(33.927125440097875, 32.054847113210094), new Coordinate(33.929011051318348, 31.97878189417845), new Coordinate(33.819000337359398, 31.97406740944362), new Coordinate(33.821829475819285, 32.051075573685317) } }; // Act. for (int i = 0; i < shapeOffsets.Length; i++) { IGeometry geo = m_Reader.ReadShapeAtOffset(shapeOffsets[i], factory); // Assert. Assert.IsNotNull(geo); Assert.IsTrue(geo.IsValid); Assert.IsInstanceOf<IPolygon>(geo); IPolygon givenPoly = geo as IPolygon; Assert.IsNotNull(givenPoly.ExteriorRing); Assert.AreSame(givenPoly.ExteriorRing, givenPoly.Shell); Assert.AreEqual(givenPoly.Shell.Coordinates.Length, expectedLines.GetLength(1)); ILineString givenLine = givenPoly.Shell; for (int j = 0; j < givenLine.Coordinates.Length; j++) { Coordinate currPoint = givenLine.Coordinates[j]; HelperMethods.AssertDoubleValuesEqual(currPoint.X, expectedLines[i, j].X); HelperMethods.AssertDoubleValuesEqual(currPoint.Y, expectedLines[i, j].Y); } } }