public void TestLocationRepo_CheckRepo() { var locationRepo = new LocationRepo(TripLineConfig.LocationRepoPath + "2", forceNew: true); Assert.IsTrue(locationRepo.Content.Locations.Count == 0); locationRepo.Add(new Location() { City = "Montreal" }); locationRepo.Save(); Assert.IsTrue(locationRepo.Content.Locations.Count == 1); locationRepo.ClearContent(); Assert.IsTrue(locationRepo.Content.Locations.Count == 0); // reload to see iuf they are really saved locationRepo.Reload(); // Check Assert.IsTrue(locationRepo.Content.Locations.Count == 1); Assert.IsTrue(locationRepo.Content.Locations[0].City == "Montreal"); }
public void GetLocationTest_CheckRepo() { int ok = 0; List <string> failed = new List <string>(); foreach (var address in _correctedTest) { var location = _locationService.GetLocation(address); if (location == null || !location.Position.IsValid()) { failed.Add(address); } else { ok += 1; } } Assert.IsTrue(failed.Count <= 3); int savedCount = _locationRepo.Content.Locations.Count; // Location not saved yet Assert.IsTrue(savedCount >= ok); _locationService.SaveLocations(); _locationRepo.ClearContent(); Assert.IsTrue(_locationRepo.Content.Locations.Count == 0); // reload to see iuf they are really saved _locationRepo.Reload(); // Check Assert.IsTrue(_locationRepo.Content.Locations.Count == savedCount); }