Skip to content

Commit

Permalink
Fixed Issue 63 with test.
Browse files Browse the repository at this point in the history
  • Loading branch information
sweco-sedahd committed Feb 6, 2025
1 parent b88dae1 commit 35de844
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/NetTopologySuite.IO.Esri.Shapefile/Dbf/DbfReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ private void Initialize(Stream stream, Encoding encoding = null)
internal void Restart()
{
DbfStream.Seek(HeaderSize, SeekOrigin.Begin);
CurrentIndex = 0;
}


Expand Down
25 changes: 25 additions & 0 deletions test/NetTopologySuite.IO.Esri.Test/Issues/Issue063.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using NUnit.Framework;

namespace NetTopologySuite.IO.Esri.Test.Issues;

/// <summary>
/// https://github.com/NetTopologySuite/NetTopologySuite.IO.Esri/issues/63
/// </summary>
internal class Issue063
{
[Test]
public void ShapefileResetTest()
{
var shpPath = TestShapefiles.PathTo("nested_polygons.shp");
using var shpReader = Shapefile.OpenRead(shpPath);

// This test need a shapefile with one feature (RecordCount == 1)
Assert.That(shpReader.RecordCount, Is.EqualTo(1));

var readOk = shpReader.Read();
Assert.IsTrue(readOk);
shpReader.Restart();
readOk = shpReader.Read();
Assert.IsTrue(readOk);
}
}

0 comments on commit 35de844

Please sign in to comment.