Okey
This commit is contained in:
@ -10,6 +10,9 @@ using Microsoft.Extensions.Options;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Hosting.Server;
|
||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using System.Threading;
|
||||
|
||||
namespace isnd.host.tests
|
||||
{
|
||||
@ -19,7 +22,7 @@ namespace isnd.host.tests
|
||||
public void TestHaveTestDbContextAndMigrate()
|
||||
{
|
||||
string envVar = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
|
||||
|
||||
IWebHost webhost = BuildWebHost(new string[0]);
|
||||
|
||||
using (var serviceScope = webhost.Services.CreateScope())
|
||||
@ -38,25 +41,35 @@ namespace isnd.host.tests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static IWebHost BuildWebHost(string[] args) =>
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
.UseStartup<Startup>().Build();
|
||||
|
||||
[Fact]
|
||||
|
||||
public async Task NugetInstallsTest()
|
||||
{
|
||||
IWebHost webhost = BuildWebHost(new string[0]);
|
||||
Task running = Task.Run(async () => await webhost.StartAsync());
|
||||
ProcessStartInfo psi = new ProcessStartInfo("nuget");
|
||||
psi.ArgumentList.Add("install");
|
||||
psi.ArgumentList.Add("isn");
|
||||
psi.ArgumentList.Add("gitversion");
|
||||
psi.ArgumentList.Add("-PreRelease");
|
||||
psi.ArgumentList.Add("-Source");
|
||||
psi.ArgumentList.Add("http://localhost:5000");
|
||||
Process p = Process.Start(psi);
|
||||
p.WaitForExit();
|
||||
await webhost.StopAsync();
|
||||
Assert.True(p.ExitCode == 0, "nuget install failed!");
|
||||
}
|
||||
|
||||
void PrintAddresses(IServiceProvider services)
|
||||
{
|
||||
Console.WriteLine("Checking addresses...");
|
||||
var server = services.GetRequiredService<IServer>();
|
||||
var addressFeature = server.Features.Get<IServerAddressesFeature>();
|
||||
foreach (var address in addressFeature.Addresses)
|
||||
{
|
||||
Console.WriteLine("Listing on address: " + address);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
<Version>0.1.175</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="XunitXml.TestLogger" Version="3.0.70"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
@ -25,7 +26,8 @@
|
||||
<ItemGroup>
|
||||
<MyTestingConfigFiles Include="appsettings.Testing.json" />
|
||||
</ItemGroup>
|
||||
<Target Name="CopyTestConfig">
|
||||
<Copy SourceFiles="@(MyTestingConfigFiles)" DestinationFolder="bin\Debug\net6.0" />
|
||||
</Target>
|
||||
<!--
|
||||
<Target Name="CopyTestConfig" AfterTargets="Build">
|
||||
<Copy SourceFiles="@(MyTestingConfigFiles)" DestinationFolder="$(OutputPath)" />
|
||||
</Target>-->
|
||||
</Project>
|
Reference in New Issue
Block a user