Upgrade test framework versions and fix test issues

This commit is contained in:
Nate McMaster 2017-05-15 14:44:17 -07:00
parent 906af6de30
commit 5cf3d9ab11
6 changed files with 21 additions and 27 deletions

View File

@ -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>

View File

@ -22,8 +22,4 @@
<PackageReference Include="xunit" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

View File

@ -25,8 +25,4 @@
<PackageReference Include="xunit" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

View File

@ -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);
}
}
}
}
}

View File

@ -837,7 +837,7 @@ namespace Microsoft.AspNetCore.Hosting
.UseStartup<StartupWithILoggerFactory>()
.Build()) { }
Assert.Equal(false, factory.Disposed);
Assert.False(factory.Disposed);
}
[Fact]

View File

@ -18,8 +18,4 @@
<PackageReference Include="xunit" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>