Import dotnetDBF for error handling.

This commit is contained in:
Patrick Fic
2022-02-11 15:06:05 -08:00
parent 991ad38839
commit f32c149bae
75 changed files with 5585 additions and 7 deletions

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace DotNetDBF.Test
{
[TestFixture]
public class Issue19Test
{
private Stream DbfsData(string filename) => typeof(Issue19Test).Assembly
.GetManifestResourceStream($"{nameof(DotNetDBF)}.{nameof(Test)}.dbfs.{filename}");
[Test]
public void ReadTest()
{
using (var dbfstream = DbfsData("dbase_8b.dbf"))
using (var memoStream = DbfsData("dbase_8b.dbt"))
using (DBFReader dbfr = new DBFReader(dbfstream) { DataMemo = memoStream})
{
object[] record = dbfr.NextRecord();
//This line would hang issue #19 https://github.com/ekonbenefits/dotnetdbf/issues/19
Assert.Throws<DBTException>(() => record[5].ToString());
}
}
}
}