Skip to content

Commit

Permalink
#1-2 テストの構成を変更
Browse files Browse the repository at this point in the history
  • Loading branch information
miyaji255 committed Mar 16, 2024
1 parent f9d85b6 commit f39194a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions KoeBook.Test/DiTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ namespace KoeBook.Test;

public class DiTestBase
{
protected IHost Host { get; } = Microsoft.Extensions.Hosting.Host
.CreateDefaultBuilder()
.ConfigureCore()
.Build();
protected IHost Host { get; } = CreateDefaultBuilder().Build();

protected T GetService<T>() where T : notnull
{
return Host.Services.GetRequiredService<T>();
}

protected static IHostBuilder CreateDefaultBuilder()
{
return Microsoft.Extensions.Hosting.Host
.CreateDefaultBuilder()
.ConfigureCore();

Check failure on line 20 in KoeBook.Test/DiTestBase.cs

View workflow job for this annotation

GitHub Actions / build

'IHostBuilder' does not contain a definition for 'ConfigureCore' and no accessible extension method 'ConfigureCore' accepting a first argument of type 'IHostBuilder' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 20 in KoeBook.Test/DiTestBase.cs

View workflow job for this annotation

GitHub Actions / build

'IHostBuilder' does not contain a definition for 'ConfigureCore' and no accessible extension method 'ConfigureCore' accepting a first argument of type 'IHostBuilder' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 20 in KoeBook.Test/DiTestBase.cs

View workflow job for this annotation

GitHub Actions / test

'IHostBuilder' does not contain a definition for 'ConfigureCore' and no accessible extension method 'ConfigureCore' accepting a first argument of type 'IHostBuilder' could be found (are you missing a using directive or an assembly reference?)
}
}
2 changes: 1 addition & 1 deletion KoeBook/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public App()
Host = Microsoft.Extensions.Hosting.Host
.CreateDefaultBuilder()
.UseContentRoot(AppContext.BaseDirectory)
.ConfigureCore()
.UseCoreStartup()
.ConfigureServices((context, services) =>
{
// Default Activation Handler
Expand Down
2 changes: 1 addition & 1 deletion KoeBook/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal static class Startup
/// <summary>
/// System, Core, Epub のDIを登録します
/// </summary>
public static IHostBuilder ConfigureCore(this IHostBuilder builder)
public static IHostBuilder UseCoreStartup(this IHostBuilder builder)
{
builder.ConfigureServices((context, services) =>
{
Expand Down

0 comments on commit f39194a

Please sign in to comment.