public void SpatialFilterByDistance() { DataAssert.SameSequence( DataAssert.Data.SearchQuery <Listing>() .Where(w => AzureSearchMethods.Distance(w.Place, filterPoint) < 10000).OrderBy(q => q.CreatedAt).ToList(), DataAssert.Data.Memory <Listing>() .Where(w => w.Place != null && SpatialHelper.GetDistance(w.Place, filterPoint, DistanceUnit.Kilometers) < 10000) .OrderBy(q => q.CreatedAt) .ToList() ); }
public void SpatialOrderByDistance() { DataAssert.SameSequence( DataAssert.Data.SearchQuery <Listing>() .Where(q => q.Place != null) .OrderBy(w => AzureSearchMethods.Distance(w.Place, filterPoint)).Take(10).ToList(), DataAssert.Data.Memory <Listing>() .Where(q => q.Place != null) .OrderBy(w => SpatialHelper.GetDistance(w.Place, filterPoint, DistanceUnit.Kilometers)) .Take(10) .ToList() ); }
public void SpatialOrderByDescendingDistance() { var expect = DataAssert.Data.SearchQuery <Listing>() .Where(q => q.Place != null) .OrderByDescending(w => AzureSearchMethods.Distance(w.Place, filterPoint)).Take(10).ToList(); var actual = DataAssert.Data.Memory <Listing>() .Where(q => q.Place != null) .OrderByDescending(w => SpatialHelper.GetDistance(w.Place, filterPoint, double.MaxValue, DistanceUnit.Kilometers)) .Take(10) .ToList(); DataAssert.SameSequence( expect, actual ); }