public static WithinPolygon ( string name, double points ) : |
||
name | string | The name of the element to test. |
points | double | An array of points that defines the polygon (the second dimension must be of length 2). |
return |
public void TestWithinPolygonInvalidSecondDimension() { var points = new double[, ] { { 1, 2, 3 } }; Assert.Throws <ArgumentOutOfRangeException>(() => Query.WithinPolygon("loc", points)); }
public void TestWithinPolygon() { var points = new double[, ] { { 1.1, 2.2 }, { 3.3, 4.4 } }; var query = Query.WithinPolygon("loc", points); var expected = "{ 'loc' : { '$within' : { '$polygon' : [[1.1, 2.2], [3.3, 4.4]] } } }".Replace("'", "\""); Assert.AreEqual(expected, query.ToJson()); }