Skip to content

Commit

Permalink
Enable nullable for HostFactoryResolver.Tests (dotnet#103609)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericstj authored and rzikm committed Jun 24, 2024
1 parent e114060 commit a2de04e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,12 @@ public void ApplicationNameSetFromArgument()
{
Assembly assembly = Assembly.Load("ApplicationNameSetFromArgument");
var factory = HostFactoryResolver.ResolveServiceProviderFactory(assembly, s_WaitTimeout);
Assert.NotNull(factory);
IServiceProvider? serviceProvider = factory(Array.Empty<string>());
Assert.NotNull(serviceProvider);

var configuration = (IConfiguration)serviceProvider.GetService(typeof(IConfiguration));
var configuration = (IConfiguration?)serviceProvider.GetService(typeof(IConfiguration));
Assert.NotNull(configuration);
Assert.Equal("ApplicationNameSetFromArgument", configuration["applicationName"]);
}

Expand All @@ -284,7 +287,7 @@ public void NoSpecialEntryPointPatternCanRunInParallel()
var factory = HostFactoryResolver.ResolveServiceProviderFactory(typeof(NoSpecialEntryPointPattern.Program).Assembly, s_WaitTimeout);
Assert.NotNull(factory);

var tasks = new Task<IServiceProvider>[30];
var tasks = new Task<IServiceProvider?>[30];
int index = 0;
for (int i = 0; i < tasks.Length; i++)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit a2de04e

Please sign in to comment.