Upgrade test framework versions and fix test issues
This commit is contained in:
parent
906af6de30
commit
5cf3d9ab11
|
|
@ -3,9 +3,9 @@
|
|||
<AspNetCoreVersion>2.0.0-*</AspNetCoreVersion>
|
||||
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
|
||||
<NETStandardImplicitPackageVersion>$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>
|
||||
<TestSdkVersion>15.0.0</TestSdkVersion>
|
||||
<TestSdkVersion>15.3.0-*</TestSdkVersion>
|
||||
<WindowsApiSetsVersion>1.0.1</WindowsApiSetsVersion>
|
||||
<XunitVersion>2.2.0</XunitVersion>
|
||||
<XunitVersion>2.3.0-beta2-*</XunitVersion>
|
||||
<SerilogExtensionsLoggingVersion>1.4.0</SerilogExtensionsLoggingVersion>
|
||||
<SerilogFileSinkVersion>3.2.0</SerilogFileSinkVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -22,8 +22,4 @@
|
|||
<PackageReference Include="xunit" Version="$(XunitVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -25,8 +25,4 @@
|
|||
<PackageReference Include="xunit" Version="$(XunitVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -15,16 +15,15 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Hosting.Tests
|
||||
{
|
||||
public class StartupManagerTests : IFakeStartupCallback
|
||||
public class StartupManagerTests
|
||||
{
|
||||
private readonly IList<object> _configurationMethodCalledList = new List<object>();
|
||||
|
||||
[Fact]
|
||||
public void StartupClassMayHaveHostingServicesInjected()
|
||||
{
|
||||
var callbackStartup = new FakeStartupCallback();
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>();
|
||||
serviceCollection.AddSingleton<IFakeStartupCallback>(this);
|
||||
serviceCollection.AddSingleton<IFakeStartupCallback>(callbackStartup);
|
||||
var services = serviceCollection.BuildServiceProvider();
|
||||
|
||||
var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "WithServices");
|
||||
|
|
@ -34,7 +33,7 @@ namespace Microsoft.AspNetCore.Hosting.Tests
|
|||
app.ApplicationServices = startup.ConfigureServicesDelegate(serviceCollection);
|
||||
startup.ConfigureDelegate(app);
|
||||
|
||||
Assert.Equal(2, _configurationMethodCalledList.Count);
|
||||
Assert.Equal(2, callbackStartup.MethodsCalled);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -69,7 +68,7 @@ namespace Microsoft.AspNetCore.Hosting.Tests
|
|||
{
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>();
|
||||
serviceCollection.AddSingleton<IFakeStartupCallback>(this);
|
||||
serviceCollection.AddSingleton<IFakeStartupCallback>(new FakeStartupCallback());
|
||||
var services = serviceCollection.BuildServiceProvider();
|
||||
var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "Boom");
|
||||
var ex = Assert.Throws<InvalidOperationException>(() => StartupLoader.LoadMethods(services, type, "Boom"));
|
||||
|
|
@ -81,7 +80,7 @@ namespace Microsoft.AspNetCore.Hosting.Tests
|
|||
{
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>();
|
||||
serviceCollection.AddSingleton<IFakeStartupCallback>(this);
|
||||
serviceCollection.AddSingleton<IFakeStartupCallback>(new FakeStartupCallback());
|
||||
var services = serviceCollection.BuildServiceProvider();
|
||||
|
||||
var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "TwoConfigures");
|
||||
|
|
@ -95,7 +94,7 @@ namespace Microsoft.AspNetCore.Hosting.Tests
|
|||
{
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>();
|
||||
serviceCollection.AddSingleton<IFakeStartupCallback>(this);
|
||||
serviceCollection.AddSingleton<IFakeStartupCallback>(new FakeStartupCallback());
|
||||
var services = serviceCollection.BuildServiceProvider();
|
||||
|
||||
var diagnosticMessages = new List<string>();
|
||||
|
|
@ -110,7 +109,7 @@ namespace Microsoft.AspNetCore.Hosting.Tests
|
|||
{
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>();
|
||||
serviceCollection.AddSingleton<IFakeStartupCallback>(this);
|
||||
serviceCollection.AddSingleton<IFakeStartupCallback>(new FakeStartupCallback());
|
||||
var services = serviceCollection.BuildServiceProvider();
|
||||
|
||||
var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "TwoConfigureServices");
|
||||
|
|
@ -395,9 +394,16 @@ namespace Microsoft.AspNetCore.Hosting.Tests
|
|||
}
|
||||
}
|
||||
|
||||
public void ConfigurationMethodCalled(object instance)
|
||||
public class FakeStartupCallback : IFakeStartupCallback
|
||||
{
|
||||
_configurationMethodCalledList.Add(instance);
|
||||
private readonly IList<object> _configurationMethodCalledList = new List<object>();
|
||||
|
||||
public int MethodsCalled => _configurationMethodCalledList.Count;
|
||||
|
||||
public void ConfigurationMethodCalled(object instance)
|
||||
{
|
||||
_configurationMethodCalledList.Add(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -837,7 +837,7 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
.UseStartup<StartupWithILoggerFactory>()
|
||||
.Build()) { }
|
||||
|
||||
Assert.Equal(false, factory.Disposed);
|
||||
Assert.False(factory.Disposed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -18,8 +18,4 @@
|
|||
<PackageReference Include="xunit" Version="$(XunitVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Reference in New Issue