static TestBase() { Credentials data = JsonSerializer.Deserialize <Credentials>(File.ReadAllText("credentials.json")); GeocodeCredentials = new GeocodeCredentials() { Provider = GeocodeProvider.Google, ProviderKey = data.GeocodeProviderKey }; Client = new SovrenClient(data.AccountId, data.ServiceKey, new DataCenter("https://rest-local.sovren.com", "v10", true)); ParseResumeResponseValue parseResumeResponseValue = Client.ParseResume(new ParseRequest(TestData.Resume)).Result.Value; TestParsedResume = parseResumeResponseValue.ResumeData; parseResumeResponseValue = Client.ParseResume(new ParseRequest(TestData.ResumeWithAddress)).Result.Value; TestParsedResumeWithAddress = parseResumeResponseValue.ResumeData; ParseJobResponseValue parseJobResponseValue = Client.ParseJob(new ParseRequest(TestData.JobOrder)).Result.Value; TestParsedJob = parseJobResponseValue.JobData; parseJobResponseValue = Client.ParseJob(new ParseRequest(TestData.JobOrderWithAddress)).Result.Value; TestParsedJobWithAddress = parseJobResponseValue.JobData; parseJobResponseValue = Client.ParseJob(new ParseRequest(TestData.JobOrderTech)).Result.Value; TestParsedJobTech = parseJobResponseValue.JobData; }
public async Task TestJobGeocodeIndexReplaceAddress() { string indexId = "SDK-job-" + nameof(TestJobGeocodeIndexReplaceAddress); string documentId = "1"; try { await Client.CreateIndex(IndexType.Job, indexId); IndexSingleDocumentInfo indexingOptions = new IndexSingleDocumentInfo { IndexId = indexId, DocumentId = documentId }; GeocodeCredentials geocodeCredentials = new GeocodeCredentials() { Provider = GeocodeProvider.None }; Address address = new Address() { Municipality = "Dallas", Region = "TX", CountryCode = "US", PostalCode = "75214" }; GeocodeAndIndexJobResponse response = await Client.GeocodeAndIndex(TestParsedJobWithAddress, indexingOptions, address, geocodeCredentials); Assert.Multiple(() => { Assert.AreEqual(0m, response.Info.TransactionCost); Assert.AreEqual(address.CountryCode, response.Value.JobData.CurrentLocation.CountryCode); Assert.AreEqual(address.Region, response.Value.JobData.CurrentLocation.Regions.FirstOrDefault()); Assert.AreEqual(address.Municipality, response.Value.JobData.CurrentLocation.Municipality); Assert.AreEqual(address.PostalCode, response.Value.JobData.CurrentLocation.PostalCode); }); Assert.DoesNotThrowAsync(async() => { await Client.GetJob(indexId, documentId); }); SearchResponse searchResponse = await Client.Search(new[] { indexId }, new FilterCriteria() { LocationCriteria = new LocationCriteria() { Locations = new List <FilterLocation>() { new FilterLocation() { CountryCode = address.CountryCode, Municipality = address.Municipality, PostalCode = address.PostalCode, Region = address.Region } } } }); Assert.AreEqual(1, searchResponse.Value.CurrentCount); } finally { await CleanUpIndex(indexId); } await Task.CompletedTask; }