public void ReadEntry_SendNegativeIndex_ShouldThrowException()
        {
            // Arrange
            m_TmpFile = new TempFileCloudUploader("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader  = new DbaseReader(GetProvider(m_TmpFile.Path));

            // Act.
            m_Reader.ReadEntry(-1);
        }
        public void ReadEntry_SendNegativeIndex_ShouldThrowException()
        {
            // Arrange
            m_TmpFile = new TempFileWriter("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader = new DbaseReader(m_TmpFile.Path);

            // Act.
            m_Reader.ReadEntry(-1);
        }
Ejemplo n.º 3
0
        public void ReadEntry_SendOutOfBoundIndex_ShouldThrowException()
        {
            // Arrange
            m_TmpFile = new TempFileWriter("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader  = new DbaseReader(m_TmpFile.Path);

            // Act.
            m_Reader.ReadEntry(3);
        }
Ejemplo n.º 4
0
        public ShapefileFeature(ShapeReader shapeReader, DbaseReader dbfReader, ShapeLocationInFileInfo shapeLocation, IGeometryFactory geoFactory)
        {
            m_ShapeReader       = shapeReader;
            m_GeoFactory        = geoFactory;
            m_ShapeLocationInfo = shapeLocation;
            m_LazyGeometry      = new Lazy <IGeometry>(() => m_ShapeReader.ReadShapeAtOffset(m_ShapeLocationInfo.OffsetFromStartOfFile, m_GeoFactory), LazyThreadSafetyMode.ExecutionAndPublication);

            m_DbaseReader        = dbfReader;
            m_LazyAttributeTable = new Lazy <IAttributesTable>(() => m_DbaseReader.ReadEntry(m_ShapeLocationInfo.ShapeIndex), LazyThreadSafetyMode.ExecutionAndPublication);
        }
	    public ShapefileFeature(ShapeReader shapeReader, DbaseReader dbfReader, ShapeLocationInFileInfo shapeLocation, IGeometryFactory geoFactory)            
		{
			m_ShapeReader = shapeReader;
			m_GeoFactory = geoFactory;
			m_ShapeLocationInfo = shapeLocation;
			m_LazyGeometry = new Lazy<IGeometry>(() => m_ShapeReader.ReadShapeAtOffset(m_ShapeLocationInfo.OffsetFromStartOfFile, m_GeoFactory), LazyThreadSafetyMode.ExecutionAndPublication);

			m_DbaseReader = dbfReader;
			m_LazyAttributeTable = new Lazy<IAttributesTable>(() => m_DbaseReader.ReadEntry(m_ShapeLocationInfo.ShapeIndex), LazyThreadSafetyMode.ExecutionAndPublication);
		}
        public void ReadEntry_ReadNonExistantKeyFromEntry_ShoudReturnCorrectValues()
        {
            // Arrange
            m_TmpFile = new TempFileCloudUploader("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader  = new DbaseReader(GetProvider(m_TmpFile.Path));

            var results = m_Reader.ReadEntry(0);

            // Act.
            var a = results["a"];
        }
Ejemplo n.º 7
0
        public void ReadEntry_TryReadAfterDisposed_ShouldThrowException()
        {
            // Arrange
            m_TmpFile = new TempFileWriter("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader  = new DbaseReader(m_TmpFile.Path);

            m_Reader.Dispose();

            // Act.
            m_Reader.ReadEntry(1);
        }
Ejemplo n.º 8
0
        public void ReadEntry_ReadNonExistantKeyFromEntry_ShoudReturnCorrectValues()
        {
            // Arrange
            m_TmpFile = new TempFileWriter("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader  = new DbaseReader(m_TmpFile.Path);

            IAttributesTable results = m_Reader.ReadEntry(0);

            // Act.
            object a = results["a"];
        }
        public void ReadEntry_SendOutOfBoundIndex_ShouldThrowException()
        {
            // Arrange
            m_TmpFile = new TempFileWriter(".dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader  = new DbaseReader(m_TmpFile.Path);

            // Act.
            Assert.Catch <ArgumentOutOfRangeException>(() =>
            {
                m_Reader.ReadEntry(3);
            });
        }
        public void ReadEntry_TryReadAfterDisposed_ShouldThrowException()
        {
            // Arrange
            m_TmpFile = new TempFileWriter(".dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader  = new DbaseReader(m_TmpFile.Path);

            m_Reader.Dispose();

            // Act.
            Assert.Catch <InvalidOperationException>(() =>
            {
                m_Reader.ReadEntry(1);
            });
        }
        public void ReadEntry_ReadNonExistantKeyFromEntry_ShoudReturnCorrectValues()
        {
            // Arrange
            m_TmpFile = new TempFileWriter(".dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader  = new DbaseReader(m_TmpFile.Path);

            var results = m_Reader.ReadEntry(0);

            // Act.
            Assert.Catch <ArgumentException>(() =>
            {
                object a = results["a"];
            });
        }
Ejemplo n.º 12
0
        public void ReadEntry_TryReadAfterDisposed_ShouldThrowException()
        {
            // Arrange
            m_TmpFile = new TempFileWriter("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader = new DbaseReader(m_TmpFile.Path);

            m_Reader.Dispose();

            // Act.
            m_Reader.ReadEntry(1);
        }
Ejemplo n.º 13
0
        public void ReadEntry_ReadNonExistantKeyFromEntry_ShoudReturnCorrectValues()
        {
            // Arrange
            m_TmpFile = new TempFileWriter("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader = new DbaseReader(m_TmpFile.Path);

            IAttributesTable results = m_Reader.ReadEntry(0);

            // Act.
            object a = results["a"];
        }
Ejemplo n.º 14
0
        public void ReadEntry_ReadEntryValues_ShoudReturnCorrectValues()
        {
            // Arrange
            m_TmpFile = new TempFileWriter("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader = new DbaseReader(m_TmpFile.Path);

            var expectedTable = new
            {
                Ids = new double[] 
				{ 
					3, 2, 1
				},
                Strings = new string[] 
				{ 
					"str3", "str2", "str1"
				},
                WholeNums = new double[] 
				{ 
					3, 2, 1
				},
                DecNums = new double[] 
				{
					3, 2, 1
				},
            };

            // Act.
            IAttributesTable[] results = new IAttributesTable[]
			{
				m_Reader.ReadEntry(0),
				m_Reader.ReadEntry(1),
				m_Reader.ReadEntry(2)
			};

            // Assert.
            int currResIndex = 0;
            foreach (IAttributesTable res in results)
            {
                object id = res["id"];
                object str = res["str"];
                object wholeNum = res["wholeNum"];
                object decNum = res["decNum"];
                object date = res["dt"];

                Assert.IsNotNull(id);
                Assert.IsNotNull(str);
                Assert.IsNotNull(wholeNum);
                Assert.IsNotNull(decNum);
                Assert.IsNotNull(date);

                Assert.IsInstanceOf<double>(id);
                Assert.IsInstanceOf<string>(str);
                Assert.IsInstanceOf<double>(wholeNum);
                Assert.IsInstanceOf<double>(decNum);
                Assert.IsInstanceOf<DateTime>(date);

                Assert.AreEqual(id, expectedTable.Ids[currResIndex]);
                Assert.AreEqual(str, expectedTable.Strings[currResIndex]);
                Assert.AreEqual(wholeNum, expectedTable.WholeNums[currResIndex]);
                Assert.AreEqual(decNum, expectedTable.DecNums[currResIndex]);
                Assert.AreEqual(date, DATE_SAVED_IN_DBF);

                currResIndex++;
            }
        }
        public void ReadEntry_SendOutOfBoundIndex_ShouldThrowException()
        {
            // Arrange
            m_TmpFile = new TempFileCloudUploader("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader = new DbaseReader(GetProvider(m_TmpFile.Path));

            // Act.
            m_Reader.ReadEntry(3);
        }
        public void ReadEntry_ReadNonExistantKeyFromEntry_ShoudReturnCorrectValues()
        {
            // Arrange
            m_TmpFile = new TempFileCloudUploader("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader = new DbaseReader(GetProvider(m_TmpFile.Path));

            var results = m_Reader.ReadEntry(0);

            // Act.
            var a = results["a"];
        }
Ejemplo n.º 17
0
        public void ReadEntry_ReadEntryValues_ShoudReturnCorrectValues()
        {
            // Arrange
            m_TmpFile = new TempFileWriter("data.dbf", DbfFiles.Read("point_ed50_geo"));
            m_Reader  = new DbaseReader(m_TmpFile.Path);

            var expectedTable = new
            {
                Ids = new double[]
                {
                    3, 2, 1
                },
                Strings = new string[]
                {
                    "str3", "str2", "str1"
                },
                WholeNums = new double[]
                {
                    3, 2, 1
                },
                DecNums = new double[]
                {
                    3, 2, 1
                },
            };

            // Act.
            IAttributesTable[] results = new IAttributesTable[]
            {
                m_Reader.ReadEntry(0),
                m_Reader.ReadEntry(1),
                m_Reader.ReadEntry(2)
            };

            // Assert.
            int currResIndex = 0;

            foreach (IAttributesTable res in results)
            {
                object id       = res["id"];
                object str      = res["str"];
                object wholeNum = res["wholeNum"];
                object decNum   = res["decNum"];
                object date     = res["dt"];

                Assert.IsNotNull(id);
                Assert.IsNotNull(str);
                Assert.IsNotNull(wholeNum);
                Assert.IsNotNull(decNum);
                Assert.IsNotNull(date);

                Assert.IsInstanceOf <double>(id);
                Assert.IsInstanceOf <string>(str);
                Assert.IsInstanceOf <double>(wholeNum);
                Assert.IsInstanceOf <double>(decNum);
                Assert.IsInstanceOf <DateTime>(date);

                Assert.AreEqual(id, expectedTable.Ids[currResIndex]);
                Assert.AreEqual(str, expectedTable.Strings[currResIndex]);
                Assert.AreEqual(wholeNum, expectedTable.WholeNums[currResIndex]);
                Assert.AreEqual(decNum, expectedTable.DecNums[currResIndex]);
                Assert.AreEqual(date, DATE_SAVED_IN_DBF);

                currResIndex++;
            }
        }
Ejemplo n.º 18
0
 public ShapefileFeature(ShapeReader shapeReader, DbaseReader dbfReader, ShapeLocationInFileInfo shapeLocation, GeometryFactory geoFactory)
 {
     FeatureId           = shapeLocation.ShapeIndex;
     _lazyGeometry       = new Lazy <Geometry>(() => shapeReader.ReadShapeAtOffset(shapeLocation.OffsetFromStartOfFile, geoFactory), LazyThreadSafetyMode.ExecutionAndPublication);
     _lazyAttributeTable = new Lazy <IAttributesTable>(() => dbfReader.ReadEntry(shapeLocation.ShapeIndex), LazyThreadSafetyMode.ExecutionAndPublication);
 }