public void ReadShapeAtIndex_SendNullFactory_ShouldThrowException()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader  = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);

            // Act.
            m_Reader.ReadShapeAtIndex(0, null);
        }
        public void ReadShapeAtIndex_SendOutOfBoundIndex_ShouldThrowException()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader  = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            // Act.
            m_Reader.ReadShapeAtIndex(2, factory);
        }
        public void ReadShapeAtIndex_SendNegativeIndex_ShouldThrowException()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter(".shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader  = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            GeometryFactory factory = new GeometryFactory();

            // Act.
            Assert.Catch <ArgumentOutOfRangeException>(() =>
            {
                m_Reader.ReadShapeAtIndex(-1, factory);
            });
        }
        public void ReadShapeAtIndex_TryReadAfterDisposed_ShouldThrowException()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter(".shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader  = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            GeometryFactory factory = new GeometryFactory();

            // Act.
            m_Reader.Dispose();
            Assert.Catch <InvalidOperationException>(() =>
            {
                m_Reader.ReadShapeAtIndex(0, factory);
            });
        }
        public void ReadShapeAtIndex_ReadSecondUnifiedCheckMaterialShape_ShouldReturnTriangle()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader  = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            Polygon expectedPolygon = new Polygon(new LinearRing(new Coordinate[]
            {
                new Coordinate(0.068181818181818, 0.578282828282829),
                new Coordinate(0.421717171717172, 0.070707070707071),
                new Coordinate(-0.457070707070707, 0.080808080808081),
                new Coordinate(0.068181818181818, 0.578282828282829),
            }));

            // Act.
            IGeometry polygon = m_Reader.ReadShapeAtIndex(1, factory);

            Assert.IsNotNull(polygon);
            Assert.IsInstanceOf <IPolygon>(polygon);
            HelperMethods.AssertPolygonsEqual(polygon as IPolygon, expectedPolygon);
        }
        public void ReadShapeAtIndex_ReadFirstUnifiedCheckMaterialShape_ShouldReturnRectangle()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader  = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            Polygon expectedPolygon = new Polygon(new LinearRing(new Coordinate[]
            {
                new Coordinate(-0.815656565656566, -0.439393939393939),
                new Coordinate(-0.353535353535354, -0.795454545454545),
                new Coordinate(-0.888888888888889, -0.929292929292929),
                new Coordinate(-1.151515151515152, -0.419191919191919),
                new Coordinate(-0.815656565656566, -0.439393939393939),
            }));

            // Act.
            IGeometry polygon = m_Reader.ReadShapeAtIndex(0, factory);

            Assert.IsNotNull(polygon);
            Assert.IsInstanceOf <IPolygon>(polygon);
            HelperMethods.AssertPolygonsEqual(polygon as IPolygon, expectedPolygon);
        }
        public void ReadShapeAtIndex_ReadUnifiedCheckMaterialWithNulLInMiddle_ShouldReturnBothShapesCorrectly()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterialNullInMiddle"));
            m_Reader  = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            IPolygon[] expectedResult = new Polygon[]
            {
                new Polygon(new LinearRing(new Coordinate[]
                {
                    new Coordinate(-0.815656565656566, -0.439393939393939),
                    new Coordinate(-0.353535353535354, -0.795454545454545),
                    new Coordinate(-0.888888888888889, -0.929292929292929),
                    new Coordinate(-1.151515151515152, -0.419191919191919),
                    new Coordinate(-0.815656565656566, -0.439393939393939),
                })),
                new Polygon(new LinearRing(new Coordinate[]
                {
                    new Coordinate(0.068181818181818, 0.578282828282829),
                    new Coordinate(0.421717171717172, 0.070707070707071),
                    new Coordinate(-0.457070707070707, 0.080808080808081),
                    new Coordinate(0.068181818181818, 0.578282828282829),
                }))
            };

            // Act.
            for (int i = 0; i < expectedResult.Length; i++)
            {
                IGeometry result = m_Reader.ReadShapeAtIndex(i, factory);

                Assert.IsNotNull(result);
                Assert.IsInstanceOf <IPolygon>(result);

                HelperMethods.AssertPolygonsEqual(expectedResult[i], result as IPolygon);
            }
        }
Ejemplo n.º 8
0
        public void ReadShapeAtIndex_SendNegativeIndex_ShouldThrowException()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            // Act.
            m_Reader.ReadShapeAtIndex(-1, factory);
        }
Ejemplo n.º 9
0
        public void ReadShapeAtIndex_SendNullFactory_ShouldThrowException()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);

            // Act.
            m_Reader.ReadShapeAtIndex(0, null);
        }
Ejemplo n.º 10
0
        public void ReadShapeAtIndex_ReadUnifiedCheckMaterialWithNulLInMiddle_ShouldReturnBothShapesCorrectly()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterialNullInMiddle"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            IPolygon[] expectedResult = new Polygon[]
			{
				new Polygon(new LinearRing(new Coordinate[]
					{
						new Coordinate(-0.815656565656566, -0.439393939393939),
						new Coordinate(-0.353535353535354, -0.795454545454545),
						new Coordinate(-0.888888888888889,-0.929292929292929),
						new Coordinate(-1.151515151515152, -0.419191919191919),
						new Coordinate(-0.815656565656566,-0.439393939393939),
					})),
				new Polygon(new LinearRing(new Coordinate[]
					{
						new Coordinate(0.068181818181818,0.578282828282829),
						new Coordinate(0.421717171717172,0.070707070707071),
						new Coordinate(-0.457070707070707,0.080808080808081),
						new Coordinate(0.068181818181818,0.578282828282829),
					}))
			};

            // Act.
            for (int i = 0; i < expectedResult.Length; i++)
            {
                IGeometry result = m_Reader.ReadShapeAtIndex(i, factory);

                Assert.IsNotNull(result);
                Assert.IsInstanceOf<IPolygon>(result);

                HelperMethods.AssertPolygonsEqual(expectedResult[i], result as IPolygon);
            }
        }
Ejemplo n.º 11
0
        public void ReadShapeAtIndex_ReadSecondUnifiedCheckMaterialShape_ShouldReturnTriangle()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            Polygon expectedPolygon = new Polygon(new LinearRing(new Coordinate[]
					{
						new Coordinate(0.068181818181818,0.578282828282829),
						new Coordinate(0.421717171717172,0.070707070707071),
						new Coordinate(-0.457070707070707,0.080808080808081),
						new Coordinate(0.068181818181818,0.578282828282829),
					}));

            // Act.
            IGeometry polygon = m_Reader.ReadShapeAtIndex(1, factory);

            Assert.IsNotNull(polygon);
            Assert.IsInstanceOf<IPolygon>(polygon);
            HelperMethods.AssertPolygonsEqual(polygon as IPolygon, expectedPolygon);
        }
Ejemplo n.º 12
0
        public void ReadShapeAtIndex_ReadFirstUnifiedCheckMaterialShape_ShouldReturnRectangle()
        {
            // Arrange.
            m_TmpFile = new TempFileWriter("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(m_TmpFile.Path);
            IGeometryFactory factory = new GeometryFactory();

            Polygon expectedPolygon = new Polygon(new LinearRing(new Coordinate[]
					{
						new Coordinate(-0.815656565656566, -0.439393939393939),
						new Coordinate(-0.353535353535354, -0.795454545454545),
						new Coordinate(-0.888888888888889,-0.929292929292929),
						new Coordinate(-1.151515151515152, -0.419191919191919),
						new Coordinate(-0.815656565656566,-0.439393939393939),
					}));

            // Act.
            IGeometry polygon = m_Reader.ReadShapeAtIndex(0, factory);

            Assert.IsNotNull(polygon);
            Assert.IsInstanceOf<IPolygon>(polygon);
            HelperMethods.AssertPolygonsEqual(polygon as IPolygon, expectedPolygon);
        }
        public void ReadShapeAtIndex_SendNullFactory_ShouldThrowException()
        {
            // Arrange.
            m_TmpFile = new TempFileCloudUploader("shape.shp", ShpFiles.Read("UnifiedChecksMaterial"));
            m_Reader = new IO.ShapeFile.Extended.ShapeReader(new ShapefileStreamProviderRegistry(GetProvider(m_TmpFile.Path), null, true, false));

            // Act.
            m_Reader.ReadShapeAtIndex(0, null);
        }