コード例 #1
0
        public void Should_ReturnCorrectPoint_When_XStringAndYStringAreValid()
        {
            var pointFactory = new PointFactory();
            var point        = pointFactory.CreatePoint("12", "25");

            Assert.AreEqual(12, point.X);
            Assert.AreEqual(25, point.Y);
        }
コード例 #2
0
 private static LinearRing CreateSimplestRing()
 {
     return(new LinearRing
     {
         Points = new List <Point>
         {
             PointFactory.CreatePoint(0, 0), PointFactory.CreatePoint(0, 1), PointFactory.CreatePoint(1, 1), PointFactory.CreatePoint(1, 0), PointFactory.CreatePoint(0, 0),
         }
     });
 }
コード例 #3
0
        public void ShouldGetAllPoints()
        {
            var linearRing = new LinearRing
            {
                Points = new List <Point>
                {
                    PointFactory.CreatePoint(0, 0),
                    PointFactory.CreatePoint(.5, 1),
                    PointFactory.CreatePoint(1, 0),
                    PointFactory.CreatePoint(0, 0)
                }
            };

            var ring = Ring.FromLinearRing(linearRing);

            Assert.AreEqual(4, ring.Points.Length);
        }
コード例 #4
0
 private static FieldBoundary CreateBoundary(int boundaryId, int fieldId)
 {
     return(new FieldBoundary
     {
         FieldId = fieldId,
         Id =
         {
             ReferenceId = boundaryId
         },
         SpatialData = new MultiPolygon
         {
             Polygons = new List <Polygon>
             {
                 new Polygon
                 {
                     ExteriorRing = new LinearRing
                     {
                         Points = new List <Point>
                         {
                             PointFactory.CreatePoint(56, 21),
                             PointFactory.CreatePoint(58, 67),
                             PointFactory.CreatePoint(54, 32),
                         }
                     }
                 },
                 new Polygon
                 {
                     ExteriorRing = new LinearRing
                     {
                         Points = new List <Point>
                         {
                             PointFactory.CreatePoint(61, 3),
                             PointFactory.CreatePoint(66, 7),
                             PointFactory.CreatePoint(62, 2)
                         }
                     }
                 }
             }
         }
     });
 }
コード例 #5
0
 public void Should_ThrowArgumentException_When_XStringIsValidAndYStringIsNotANumber()
 {
     var pointFactory = new PointFactory();
     var point        = pointFactory.CreatePoint("24", "abc");
 }
コード例 #6
0
 public void Should_ThrowArgumentException_When_XStringIsNullAndYStringIsValid()
 {
     var pointFactory = new PointFactory();
     var point        = pointFactory.CreatePoint(null, "34");
 }