Skip to content

Commit a26a761

Browse files
committed
Restore strict Google bias and postal assertions
Root cause: test modernization simplified two Google assertions and removed important location-specific expectations used to guard regression behavior.
1 parent 0823eb7 commit a26a761

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

test/Geocoding.Tests/GoogleGeocoderTest.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public async Task Geocode_WithRegionBias_ReturnsBiasedResult(string address, str
9393

9494
[Theory]
9595
[InlineData("Winnetka", 46, -90, 47, -91, "Winnetka, IL")]
96-
[InlineData("Winnetka", 34.172684, -118.604794, 34.236144, -118.500938, "Winnetka, Los Angeles, CA")]
96+
[InlineData("Winnetka", 34.172684, -118.604794, 34.236144, -118.500938, "Winnetka, Los Angeles, CA, USA")]
9797
public async Task Geocode_WithBoundsBias_ReturnsBiasedResult(string address, double biasLatitude1, double biasLongitude1, double biasLatitude2, double biasLongitude2, string expectedSubstring)
9898
{
9999
// Arrange
@@ -169,19 +169,22 @@ public async Task Geocode_WithAdminAreaFilter_ReturnsFilteredResults(string addr
169169
Assert.DoesNotContain(addresses, x => HasShortName(x, "NJ"));
170170
}
171171

172-
[Fact]
173-
public async Task Geocode_WithPostalCodeFilter_ReturnsResultInExpectedPostalCode()
172+
[Theory]
173+
[InlineData("Rothwell")]
174+
public async Task Geocode_WithPostalCodeFilter_ReturnsExpectedRegionalResults(string address)
174175
{
175176
// Arrange
176177
var geocoder = GetGeocoder<GoogleGeocoder>();
177178
geocoder.ComponentFilters = new List<GoogleComponentFilter>();
178-
geocoder.ComponentFilters.Add(new GoogleComponentFilter(GoogleComponentFilterType.PostalCode, "94043"));
179+
geocoder.ComponentFilters.Add(new GoogleComponentFilter(GoogleComponentFilterType.PostalCode, "NN14"));
179180

180181
// Act
181-
var addresses = (await geocoder.GeocodeAsync("1600 Amphitheatre Parkway, Mountain View, CA", TestContext.Current.CancellationToken)).ToArray();
182+
var addresses = (await geocoder.GeocodeAsync(address, TestContext.Current.CancellationToken)).ToArray();
182183

183184
// Assert
184-
Assert.Contains(addresses, x => HasShortName(x, "94043"));
185+
Assert.Contains(addresses, x => HasShortName(x, "Northamptonshire"));
186+
Assert.DoesNotContain(addresses, x => HasShortName(x, "West Yorkshire"));
187+
Assert.DoesNotContain(addresses, x => HasShortName(x, "Moreton Bay"));
185188
}
186189

187190
[Fact]

0 commit comments

Comments
 (0)