forked from SolrNet/SolrNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolrQueryByDistanceTests.cs
37 lines (32 loc) · 1.22 KB
/
SolrQueryByDistanceTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using MbUnit.Framework;
namespace SolrNet.Tests {
[TestFixture]
public class SolrQueryByDistanceTests {
[Test]
[ExpectedException(typeof (ArgumentNullException))]
public void NullField_should_throw() {
var q = new SolrQueryByDistance(null, 45.15, -93.85, 5);
}
[Test]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
public void NegativeDistance_should_throw() {
var q = new SolrQueryByDistance("store", 45.15, -93.85, -100);
}
[Test]
public void DefaultAccuracy_is_radius() {
var q = new SolrQueryByDistance("store", 45.15, -93.85, 5);
Assert.AreEqual(CalculationAccuracy.Radius, q.Accuracy);
}
[Test]
public void Basic() {
var q = new SolrQueryByDistance("store", 45.15, -93.85, 5.2);
Assert.AreEqual("{!geofilt pt=45.15,-93.85 sfield=store d=5.2}", q.Query);
}
[Test]
public void Basic_lower_accuracy() {
var q = new SolrQueryByDistance("store", 45.15, -93.85, 5, CalculationAccuracy.BoundingBox);
Assert.AreEqual("{!bbox pt=45.15,-93.85 sfield=store d=5}", q.Query);
}
}
}