-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the issue with the column length mismatch: the 'D' column should be 8 characters long, and the 'L' column should be 1 character long.
- Loading branch information
1 parent
e6b6323
commit d27c690
Showing
5 changed files
with
57 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NetTopologySuite.Features; | ||
using NetTopologySuite.IO.Esri.Dbf; | ||
using NUnit.Framework; | ||
|
||
namespace NetTopologySuite.IO.Esri.Test.Issues | ||
{ | ||
/// <summary> | ||
/// https://github.com/NetTopologySuite/NetTopologySuite.IO.Esri/issues/51 | ||
/// </summary> | ||
internal class Issue051 | ||
{ | ||
[Test] | ||
public void Read_When_ColumnLengthMissmatch() | ||
{ | ||
var shpPath = TestShapefiles.PathTo("#51-columnLengthMissmatch.dbf"); | ||
List<IAttributesTable> attributes = null; | ||
Assert.DoesNotThrow(() => | ||
{ | ||
var dbfReader = new DbfReader(shpPath); | ||
attributes = dbfReader.ToList(); | ||
}); | ||
|
||
Assert.NotNull(attributes); | ||
|
||
//First row is null and empty | ||
Assert.AreEqual(string.Empty, attributes[0]["RoadLinkId"]); | ||
Assert.AreEqual(null, attributes[0]["Tunnel"]); | ||
Assert.AreEqual(null, attributes[0]["Bridge"]); | ||
Assert.AreEqual(null, attributes[0]["CarAccess"]); | ||
Assert.AreEqual(null, attributes[0]["Walk"]); | ||
Assert.AreEqual(null, attributes[0]["MF_4_7"]); | ||
Assert.AreEqual(null, attributes[0]["COREID"]); | ||
|
||
//Second row has value but length is missmatch in each column | ||
Assert.AreEqual("osgb4000000080908489", attributes[1]["RoadLinkId"]); | ||
Assert.AreEqual(true, attributes[1]["Tunnel"]); | ||
Assert.AreEqual(false, attributes[1]["Bridge"]); | ||
Assert.AreEqual(true, attributes[1]["CarAccess"]); | ||
Assert.AreEqual(4.8, attributes[1]["Walk"]); | ||
Assert.AreEqual(50, attributes[1]["MF_4_7"]); | ||
Assert.AreEqual(55483, attributes[1]["COREID"]); | ||
} | ||
} | ||
} |
Binary file not shown.