Skip to content

Commit

Permalink
Enable service validation and add a RegionData impl for GenericS3
Browse files Browse the repository at this point in the history
  • Loading branch information
Genbox committed Aug 28, 2024
1 parent beea94b commit 96b4bc2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Src/SimpleS3.Core.TestBase/UnitTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected UnitTestBase(ITestOutputHelper helper, string bucketName)

ConfigureServices(collection);

Services = collection.BuildServiceProvider();
Services = collection.BuildServiceProvider(new ServiceProviderOptions { ValidateOnBuild = true });
}

protected ServiceProvider Services { get; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Genbox.SimpleS3.Core.Abstracts;
using Genbox.SimpleS3.Core.Abstracts.Provider;
using Genbox.SimpleS3.Core.Abstracts.Region;
using Genbox.SimpleS3.Core.Common.Extensions;
using Genbox.SimpleS3.Core.Common.Helpers;
using Microsoft.Extensions.DependencyInjection;
Expand All @@ -23,6 +24,7 @@ public static ICoreBuilder UseGenericS3(this ICoreBuilder clientBuilder, Action<

public static ICoreBuilder UseGenericS3(this ICoreBuilder clientBuilder)
{
clientBuilder.Services.AddSingleton<IRegionData, GenericS3RegionData>();
clientBuilder.Services.AddSingleton<IInputValidator, GenericS3InputValidator>();

clientBuilder.Services.PostConfigure<SimpleS3Config>((x, y) =>
Expand Down
13 changes: 13 additions & 0 deletions Src/SimpleS3.Extensions.GenericS3/GenericS3RegionData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Genbox.SimpleS3.Core.Abstracts.Region;

namespace Genbox.SimpleS3.Extensions.GenericS3;

public class GenericS3RegionData : IRegionData
{
public static GenericS3RegionData Instance { get; } = new GenericS3RegionData();

public IEnumerable<IRegionInfo> GetRegions()
{
yield break;
}
}

0 comments on commit 96b4bc2

Please sign in to comment.