MX.GeoLocation.Api.Client.Testing
1.2.98
See the version list below for details.
dotnet add package MX.GeoLocation.Api.Client.Testing --version 1.2.98
NuGet\Install-Package MX.GeoLocation.Api.Client.Testing -Version 1.2.98
<PackageReference Include="MX.GeoLocation.Api.Client.Testing" Version="1.2.98" />
<PackageVersion Include="MX.GeoLocation.Api.Client.Testing" Version="1.2.98" />
<PackageReference Include="MX.GeoLocation.Api.Client.Testing" />
paket add MX.GeoLocation.Api.Client.Testing --version 1.2.98
#r "nuget: MX.GeoLocation.Api.Client.Testing, 1.2.98"
#:package MX.GeoLocation.Api.Client.Testing@1.2.98
#addin nuget:?package=MX.GeoLocation.Api.Client.Testing&version=1.2.98
#tool nuget:?package=MX.GeoLocation.Api.Client.Testing&version=1.2.98
MX.GeoLocation.Api.Client.Testing
Test helpers for consumer applications that depend on the GeoLocation API client. Provides in-memory fakes of IGeoLocationApiClient, DTO factory methods, and DI extensions for integration tests.
Installation
dotnet add package MX.GeoLocation.Api.Client.Testing
Quick Start — Integration Tests
Replace the real client with fakes in your test DI container:
services.AddFakeGeoLocationApiClient(client =>
{
client.V1Lookup.AddResponse("8.8.8.8",
GeoLocationDtoFactory.CreateGeoLocation(
address: "8.8.8.8",
cityName: "Mountain View",
countryName: "United States"));
});
Quick Start — Unit Tests
Create and configure the fake client directly:
var fakeClient = new FakeGeoLocationApiClient();
fakeClient.V1Lookup.AddResponse("1.1.1.1",
GeoLocationDtoFactory.CreateGeoLocation(cityName: "San Francisco"));
fakeClient.V1_1Lookup.AddCityResponse("1.1.1.1",
GeoLocationDtoFactory.CreateCityGeoLocation(cityName: "San Francisco"));
var sut = new MyService(fakeClient);
var result = await sut.LookupAddress("1.1.1.1");
Assert.Equal("San Francisco", result?.CityName);
DTO Factories
GeoLocationDtoFactory provides static factory methods with sensible defaults:
GeoLocationDtoFactory.CreateGeoLocation(address: "10.0.0.1", cityName: "London");
GeoLocationDtoFactory.CreateCityGeoLocation(countryName: "UK");
GeoLocationDtoFactory.CreateInsightsGeoLocation(cityName: "Berlin");
GeoLocationDtoFactory.CreateNetworkTraits(isp: "Cloudflare");
GeoLocationDtoFactory.CreateAnonymizer(isAnonymousVpn: true);
GeoLocationDtoFactory.CreateApiInfo(version: "1.0.0");
Configuring Error Responses
fakeClient.V1Lookup.AddErrorResponse("invalid-host",
HttpStatusCode.NotFound, "NotFound", "Address not found");
fakeClient.V1Lookup.SetDefaultBehavior(DefaultLookupBehavior.ReturnError);
Tracking Calls
The fake APIs expose read-only collections to verify interactions:
Assert.Contains("8.8.8.8", fakeClient.V1Lookup.LookedUpAddresses);
Assert.Contains("old-record", fakeClient.V1Lookup.DeletedAddresses);
Assert.Contains("1.1.1.1", fakeClient.V1_1Lookup.CityLookedUpAddresses);
Resetting State Between Tests
fakeClient.Reset(); // Clears all configured responses and tracked calls
License
This project is licensed under the GPL-3.0-only license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- MX.Api.Abstractions (>= 2.3.77)
- MX.GeoLocation.Abstractions.V1 (>= 1.2.98)
- MX.GeoLocation.Api.Client.V1 (>= 1.2.98)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- MX.Api.Abstractions (>= 2.3.77)
- MX.GeoLocation.Abstractions.V1 (>= 1.2.98)
- MX.GeoLocation.Api.Client.V1 (>= 1.2.98)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.159 | 111 | 11/24/2026 |
| 1.2.156 | 99 | 11/23/2026 |
| 1.2.148 | 109 | 11/10/2026 |
| 1.2.144 | 120 | 11/5/2026 |
| 1.2.108 | 193 | 9/1/2026 |
| 1.2.106 | 132 | 8/31/2026 |
| 1.2.98 | 217 | 8/3/2026 |
| 1.2.96 | 147 | 7/28/2026 |
| 1.2.95 | 158 | 7/26/2026 |
| 1.2.89 | 181 | 6/28/2026 |
| 1.2.84 | 153 | 6/25/2026 |
| 1.2.75 | 163 | 6/23/2026 |
| 1.2.72 | 147 | 6/22/2026 |
| 1.2.63 | 168 | 6/21/2026 |
| 1.2.46 | 199 | 4/26/2026 |
| 1.2.39 | 413 | 4/5/2026 |
| 1.2.38 | 128 | 4/5/2026 |
| 1.2.36 | 129 | 4/5/2026 |
| 1.2.35 | 136 | 4/5/2026 |
| 1.2.27 | 143 | 3/22/2026 |