Skip to content

Commit 0fc2809

Browse files
authored
Enable nullable for HostFactoryResolver.Tests (#103609)
1 parent d8f796b commit 0fc2809

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/HostFactoryResolverTests.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,12 @@ public void ApplicationNameSetFromArgument()
271271
{
272272
Assembly assembly = Assembly.Load("ApplicationNameSetFromArgument");
273273
var factory = HostFactoryResolver.ResolveServiceProviderFactory(assembly, s_WaitTimeout);
274+
Assert.NotNull(factory);
274275
IServiceProvider? serviceProvider = factory(Array.Empty<string>());
276+
Assert.NotNull(serviceProvider);
275277

276-
var configuration = (IConfiguration)serviceProvider.GetService(typeof(IConfiguration));
278+
var configuration = (IConfiguration?)serviceProvider.GetService(typeof(IConfiguration));
279+
Assert.NotNull(configuration);
277280
Assert.Equal("ApplicationNameSetFromArgument", configuration["applicationName"]);
278281
}
279282

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

287-
var tasks = new Task<IServiceProvider>[30];
290+
var tasks = new Task<IServiceProvider?>[30];
288291
int index = 0;
289292
for (int i = 0; i < tasks.Length; i++)
290293
{

src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/Microsoft.Extensions.HostFactoryResolver.Tests.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks>
4+
<Nullable>enable</Nullable>
45
</PropertyGroup>
56

67
<ItemGroup>

0 commit comments

Comments
 (0)