Skip to content

Commit

Permalink
fix: Hotfixed dodgy base name in DI, added test to prevent future reg…
Browse files Browse the repository at this point in the history
…ression
  • Loading branch information
hughesjs committed Mar 13, 2023
1 parent 09cdc05 commit c1c04c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using CelesTrakSdk.Microsoft.Extensions.DependencyInjection.DependencyInjection;
using CelesTrakSdk.Public.Clients;
using CelesTrakSdk.Public.Models.Enums;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;

Expand All @@ -19,4 +20,17 @@ public void CanGetClientFromServiceProvider()

client.ShouldNotBeNull();
}

[Fact]
public async Task CanGetResultFromResolvedClient()
{
IServiceCollection collection = new ServiceCollection();
_ = collection.AddCelesTrakServices();

ServiceProvider provider = collection.BuildServiceProvider();
ICelesTrakClient? client = provider.GetService<ICelesTrakClient>();

client.ShouldNotBeNull();
await Should.NotThrowAsync(async () => await client.GetRecords(SatCatRecordQueryType.Group, "STATIONS"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static class DependencyInjectionExtensions
{
public static IServiceCollection AddCelesTrakServices(this IServiceCollection services)
{
services.AddHttpClient<ICelesTrakClient, CelesTrakClient>(h => h.BaseAddress = new("https://celestrak.org/satcat/records.php"));
services.AddHttpClient<ICelesTrakClient, CelesTrakClient>(h => h.BaseAddress = new("https://celestrak.org/"));

return services;
}
Expand Down

0 comments on commit c1c04c0

Please sign in to comment.