public void ValidateNoFullGlobe()
        {
            GeometryPipeline v = new SpatialValidatorImplementation();
            var ex             = SpatialTestUtils.RunCatching <FormatException>(() => v.BeginGeometry(SpatialType.FullGlobe));

            Assert.IsNotNull(ex);
            Assert.AreEqual(Strings.Validator_InvalidType(SpatialType.FullGlobe), ex.Message);
        }
Esempio n. 2
0
        public void ValidateFullGlobe_Geography()
        {
            GeographyPipeline v = new SpatialValidatorImplementation();

            v.SetCoordinateSystem(NonDefaultGeographicCoords);
            v.BeginGeography(SpatialType.FullGlobe);
            v.EndGeography();
        }
Esempio n. 3
0
        public void ExpectFailureOnCrossingPipelines()
        {
            var validator5 = new SpatialValidatorImplementation();

            validator5.GeographyPipeline.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
            validator5.GeographyPipeline.BeginGeography(SpatialType.Point);
            Action test = () => validator5.GeometryPipeline.BeginFigure(new GeometryPosition(333, 3333333, 333, 333));

            test.ShouldThrow <FormatException>().WithMessage(Strings.Validator_UnexpectedCall("SetCoordinateSystem", "BeginFigure"));
        }
Esempio n. 4
0
        public void ValidateFullGlobe_Geometry()
        {
            GeometryPipeline v = new SpatialValidatorImplementation();

            v.SetCoordinateSystem(NonDefaultGeometricCoords);

            var ex = SpatialTestUtils.RunCatching <FormatException>(() => v.BeginGeometry(SpatialType.FullGlobe));

            Assert.NotNull(ex);
            Assert.Equal(Strings.Validator_InvalidType(SpatialType.FullGlobe), ex.Message);
        }
        public void ValidatePolygonRing()
        {
            GeometryPipeline v = new SpatialValidatorImplementation();

            v.SetCoordinateSystem(NonDefaultGeometricCoords);
            v.BeginGeometry(SpatialType.Polygon);
            v.BeginFigure(new GeometryPosition(10, 20, 30, 40));
            v.LineTo(new GeometryPosition(20, 30, 40, 50));
            v.LineTo(new GeometryPosition(20, 40, 40, 50));
            v.LineTo(new GeometryPosition(10, 20, 30, 40));
            v.EndFigure();
            v.EndGeometry();
        }
        public void ValidatePolygonRing_LessThanFour()
        {
            GeometryPipeline v = new SpatialValidatorImplementation();

            v.SetCoordinateSystem(NonDefaultGeometricCoords);
            v.BeginGeometry(SpatialType.Polygon);
            v.BeginFigure(new GeometryPosition(10, 20, 30, 40));
            v.LineTo(new GeometryPosition(20, 30, 40, 50));
            v.LineTo(new GeometryPosition(20, 30, 40, 50));
            var ex = SpatialTestUtils.RunCatching <FormatException>(v.EndFigure);

            Assert.IsNotNull(ex);
            Assert.AreEqual(Strings.Validator_InvalidPolygonPoints, ex.Message);
        }
Esempio n. 7
0
        public void UnexpectedGeometry()
        {
            var validator1 = new SpatialValidatorImplementation();

            validator1.GeographyPipeline.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
            validator1.GeographyPipeline.BeginGeography(SpatialType.Point);
            SpatialTestUtils.VerifyExceptionThrown <FormatException>(
                () => validator1.GeometryPipeline.BeginGeometry(SpatialType.Point),
                Strings.Validator_UnexpectedCall("SetCoordinateSystem", "BeginPoint"));

            var validator2 = new SpatialValidatorImplementation();

            validator2.GeographyPipeline.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
            validator2.GeographyPipeline.BeginGeography(SpatialType.Point);
            validator2.GeographyPipeline.BeginFigure(new GeographyPosition(45, 180, null, null));
            validator2.GeographyPipeline.EndFigure();
            SpatialTestUtils.VerifyExceptionThrown <FormatException>(
                () => validator2.GeometryPipeline.EndGeometry(),
                Strings.Validator_UnexpectedCall("SetCoordinateSystem", "End"));

            var validator3 = new SpatialValidatorImplementation();

            validator3.GeometryPipeline.SetCoordinateSystem(CoordinateSystem.DefaultGeometry);
            validator3.GeometryPipeline.BeginGeometry(SpatialType.Point);
            SpatialTestUtils.VerifyExceptionThrown <FormatException>(
                () => validator3.GeographyPipeline.BeginGeography(SpatialType.Point),
                Strings.Validator_UnexpectedCall("SetCoordinateSystem", "BeginPoint"));

            var validator4 = new SpatialValidatorImplementation();

            validator4.GeometryPipeline.SetCoordinateSystem(CoordinateSystem.DefaultGeometry);
            validator4.GeometryPipeline.BeginGeometry(SpatialType.Point);
            validator4.GeometryPipeline.BeginFigure(new GeometryPosition(45, 180, null, null));
            validator4.GeometryPipeline.EndFigure();
            SpatialTestUtils.VerifyExceptionThrown <FormatException>(
                () => validator4.GeographyPipeline.EndGeography(),
                Strings.Validator_UnexpectedCall("SetCoordinateSystem", "End"));

            var validator5 = new SpatialValidatorImplementation();

            validator5.GeographyPipeline.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
            validator5.GeographyPipeline.BeginGeography(SpatialType.Point);

            SpatialTestUtils.VerifyExceptionThrown <FormatException>(
                () => validator5.GeometryPipeline.BeginFigure(new GeometryPosition(333, 3333333, 333, 333)),
                Strings.Validator_UnexpectedCall("SetCoordinateSystem", "BeginFigure"));
        }
Esempio n. 8
0
        public void ValidateLongitude_Geography()
        {
            GeographyPipeline v = new SpatialValidatorImplementation();

            v.SetCoordinateSystem(NonDefaultGeographicCoords);
            v.BeginGeography(SpatialType.Point);

            var ex = SpatialTestUtils.RunCatching <FormatException>(() => v.BeginFigure(new GeographyPosition(0, -15070, 0, 0)));

            Assert.NotNull(ex);
            Assert.Equal(Strings.Validator_InvalidLongitudeCoordinate(-15070), ex.Message);

            v.Reset();
            v.SetCoordinateSystem(NonDefaultGeographicCoords);
            v.BeginGeography(SpatialType.Point);

            ex = SpatialTestUtils.RunCatching <FormatException>(() => v.BeginFigure(new GeographyPosition(0, 15070, 0, 0)));
            Assert.NotNull(ex);
            Assert.Equal(Strings.Validator_InvalidLongitudeCoordinate(15070), ex.Message);
        }