Esempio n. 1
0
        public void GeoFileReader_ParsesFileCorrectly2()
        {
            var gf     = new GeoFileReader();
            var target = gf.ReadRecords <CustomEntity>(@"testdata\test_geofilereadercustom2.txt", new CustomParser(4, 0, new[] { '!' }, Encoding.UTF8, false)).ToArray();

            Assert.AreEqual(3, target.Length);
        }
Esempio n. 2
0
        public void GeoFileReader_ParsesFileCorrectly1()
        {
            var gf     = new GeoFileReader();
            var target = gf.ReadRecords(@"testdata\test_geofilereadercustom1.txt", new CustomParser(9, 1, new[] { ',' }, Encoding.UTF8, true)).ToArray();

            Assert.AreEqual(2, target.Length);
        }
Esempio n. 3
0
        public void GeoFileWriter_ComposesFileCorrectly2()
        {
            new GeoFileWriter().WriteRecords<CustomEntity>(@"testdata\test_geofilewritercustom2.txt", testvalues, new CustomComposer(Encoding.UTF7, '!'));

            var gf = new GeoFileReader();
            var target = gf.ReadRecords<CustomEntity>(@"testdata\test_geofilewritercustom2.txt", new CustomParser(3, 0, new[] { '!' }, Encoding.UTF7, false)).ToArray();
            Assert.AreEqual(3, target.Length);
            CollectionAssert.AreEqual(testvalues, target, new CustomEntityComparer());
        }
Esempio n. 4
0
        public void GeoFileWriter_ComposesFileCorrectly2()
        {
            new GeoFileWriter().WriteRecords <CustomEntity>(@"testdata\test_geofilewritercustom2.txt", testvalues, new CustomComposer(Encoding.UTF7, '!'));

            var gf     = new GeoFileReader();
            var target = gf.ReadRecords <CustomEntity>(@"testdata\test_geofilewritercustom2.txt", new CustomParser(3, 0, new[] { '!' }, Encoding.UTF7, false)).ToArray();

            Assert.AreEqual(3, target.Length);
            CollectionAssert.AreEqual(testvalues, target, new CustomEntityComparer());
        }
Esempio n. 5
0
 public void GeoFileReader_ThrowsOnUnknownSpecifiedFileType()
 {
     //When and unknown filetype is specified an exception should be thrown
     var gf     = new GeoFileReader();
     var target = gf.ReadRecords <CustomEntity>(@"testdata\invalid.ext", (FileType)999, new CustomParser(5, 0, new[] { '\t' }, Encoding.UTF8, false)).ToArray();
 }
Esempio n. 6
0
 public void GeoFileReader_DoesNotThrowOnInvalidExtensionButSpecifiedFileType()
 {
     //When filetype is specified and an unknown extension is used it should be read fine
     var gf     = new GeoFileReader();
     var target = gf.ReadRecords <CustomEntity>(@"testdata\invalid.ext", FileType.Plain, new CustomParser(5, 0, new[] { '\t' }, Encoding.UTF8, false)).ToArray();
 }
Esempio n. 7
0
 public void GeoFileReader_ThrowsOnFailureWhenAutodetectingFileType()
 {
     //When filetype == autodetect and an unknown extension is used an exception should be thrown
     var gf     = new GeoFileReader();
     var target = gf.ReadRecords <CustomEntity>(@"testdata\invalid.ext", new CustomParser(5, 0, new[] { '\t' }, Encoding.UTF8, false)).ToArray();
 }
Esempio n. 8
0
 public void GeoFileReader_ThrowsOnUnknownSpecifiedFileType()
 {
     //When and unknown filetype is specified an exception should be thrown
     var gf = new GeoFileReader();
     var target = gf.ReadRecords<CustomEntity>(@"testdata\invalid.ext", (FileType)999, new CustomParser(5, 0, new[] { '\t' }, Encoding.UTF8, false)).ToArray();
 }
Esempio n. 9
0
 public void GeoFileReader_ThrowsOnFailureWhenAutodetectingFileType()
 {
     //When filetype == autodetect and an unknown extension is used an exception should be thrown
     var gf = new GeoFileReader();
     var target = gf.ReadRecords<CustomEntity>(@"testdata\invalid.ext", new CustomParser(5, 0, new[] { '\t' }, Encoding.UTF8, false)).ToArray();
 }
Esempio n. 10
0
 public void GeoFileReader_ParsesFileCorrectly2()
 {
     var gf = new GeoFileReader();
     var target = gf.ReadRecords<CustomEntity>(@"testdata\test_geofilereadercustom2.txt", new CustomParser(4, 0, new[] { '!' }, Encoding.UTF8, false)).ToArray();
     Assert.AreEqual(3, target.Length);
 }
Esempio n. 11
0
 public void GeoFileReader_DoesNotThrowOnInvalidExtensionButSpecifiedFileType()
 {
     //When filetype is specified and an unknown extension is used it should be read fine
     var gf = new GeoFileReader();
     var target = gf.ReadRecords<CustomEntity>(@"testdata\invalid.ext", FileType.Plain, new CustomParser(5, 0, new[] { '\t' }, Encoding.UTF8, false)).ToArray();
 }