public List<AdventureLocation> GetNearByAdventureLocations(GeoPoint point, GeoRange range) { var locations = new List<AdventureLocation> { new AdventureLocation(point, "test00"), new AdventureLocation(point, "test01"), new AdventureLocation(point, "test02"), new AdventureLocation(point, "test03"), new AdventureLocation(point, "test04"), new AdventureLocation(point, "test05"), new AdventureLocation(point, "test06"), new AdventureLocation(point, "test07"), new AdventureLocation(point, "test08") }; return locations; /* var setting = new ConnectionSettings(ElasticServer, 9200); setting.SetDefaultIndex("pins"); //request.ValidateRange(_defaultRangeSetting); var client = new ElasticClient(setting); var results = client.Search<Spot>(s => s .From(0) // skip .Size(10) // limit .Filter(f => f .GeoDistance("geo.location", filter => filter .Location(point.Lat, point.Lon) .Distance(range.ToString()))) .Index("pins") // which index .Type("location") // what type in the index ); return results.Documents.ToList(); */ }
public void OnPostNewTest() { var geoPoint = new GeoPoint { Lat = 0, Lon = 0 }; const string name = "Name"; var newLocationRequest = new AdventureLocation(geoPoint, name); var newLocationResponse = new AdventureLocation(geoPoint, name) { Id = "newId" }; var expectedNewResponse = new AdventureLocationSaveResponse(newLocationRequest) { AdventureLocation = newLocationResponse }; var mock = new Mock<IAdventureLocationRepository>(); mock.Setup(a => a.SaveAdventureLocation(newLocationRequest)).Returns(newLocationResponse); var target = new AdventureLocationService { AdventureLocationRepository = mock.Object }; var actual = target.OnPost(newLocationRequest) as AdventureLocationSaveResponse; Assert.AreEqual(expectedNewResponse, actual); }
public Region(GeoPoint geoPoint, string name) : base(geoPoint, name) { }
public void OnPostNewTest() { const string regionname = "regionName"; var geoPoint = new GeoPoint { Lat = 0, Lon = 0 }; var newRegionRequest = new Region { Name = regionname, Point = geoPoint }; var newRegion = new Region { Id = "newId", Name = regionname, Point = geoPoint }; var expectedNewRegionResponse = new AdventureRegionSaveResponse(newRegionRequest) { AdventureRegion = newRegion }; var mock = new Mock<IAdventureRegionRepository>(); mock.Setup(a => a.SaveAdventureRegion(newRegionRequest)).Returns(newRegion); var target = new AdventureRegionService {AdventureRegionRepository = mock.Object}; var actual = target.OnPost(newRegionRequest) as AdventureRegionSaveResponse; Assert.IsNotNull(actual); Assert.AreEqual(expectedNewRegionResponse, actual); }
public AdventureLocation(GeoPoint geoPoint, string name) : base(geoPoint, name) { Region = new Region(geoPoint, name); }