net6.0
This commit is contained in:
parent
70f6e411e5
commit
4f040be236
18 changed files with 144 additions and 99 deletions
|
|
@ -11,9 +11,13 @@ using Microsoft.AspNetCore.Hosting.Server;
|
|||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using isnd.tests;
|
||||
using NuGet.Protocol;
|
||||
using NuGet.Configuration;
|
||||
using System.Threading.Tasks;
|
||||
using NuGet.Protocol.Core.Types;
|
||||
|
||||
namespace isnd.host.tests
|
||||
{
|
||||
{
|
||||
[Collection("Web server collection")]
|
||||
public class UnitTestWebHost : IClassFixture<WebServerFixture>
|
||||
{
|
||||
|
|
@ -29,7 +33,6 @@ namespace isnd.host.tests
|
|||
using (var serviceScope = server.Host.Services.CreateScope())
|
||||
{
|
||||
var services = serviceScope.ServiceProvider;
|
||||
var isnSettings = services.GetRequiredService<IOptions<isn.Settings>>().Value;
|
||||
var myDependency = services.GetRequiredService<ApplicationDbContext>();
|
||||
myDependency.Database.Migrate();
|
||||
}
|
||||
|
|
@ -42,8 +45,6 @@ namespace isnd.host.tests
|
|||
using (var serviceScope = server.Host.Services.CreateScope())
|
||||
{
|
||||
var services = serviceScope.ServiceProvider;
|
||||
|
||||
var isnSettings = services.GetRequiredService<IOptions<isn.Settings>>().Value;
|
||||
var dbContext = services.GetRequiredService<ApplicationDbContext>();
|
||||
var paul = dbContext.Users.FirstOrDefaultAsync(u => u.Email == "paul@pschneider.fr").Result;
|
||||
if (paul!=null)
|
||||
|
|
@ -56,18 +57,41 @@ namespace isnd.host.tests
|
|||
|
||||
|
||||
[Fact]
|
||||
|
||||
public void NugetInstallsTest()
|
||||
{
|
||||
using (var serviceScope = server.Host.Services.CreateScope())
|
||||
{ var isnSettings = serviceScope.ServiceProvider.GetService<IOptions<isnd.Entities.IsndSettings>>().Value;
|
||||
string pkgSourceUrl = isnSettings.ExternalUrl + "/index.json";
|
||||
ProcessStartInfo psi = new ProcessStartInfo("nuget");
|
||||
psi.ArgumentList.Add("install");
|
||||
psi.ArgumentList.Add("gitversion");
|
||||
psi.ArgumentList.Add("-PreRelease");
|
||||
psi.ArgumentList.Add("-Source");
|
||||
psi.ArgumentList.Add("http://localhost:5000");
|
||||
psi.ArgumentList.Add(pkgSourceUrl);
|
||||
Process p = Process.Start(psi);
|
||||
p.WaitForExit();
|
||||
Assert.True(p.ExitCode == 0, "nuget install failed!");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestRegistrationV3Resource()
|
||||
{
|
||||
using (var serviceScope = server.Host.Services.CreateScope())
|
||||
{ var isnSettings = serviceScope.ServiceProvider.GetService<IOptions<isnd.Entities.IsndSettings>>().Value;
|
||||
string pkgSourceUrl = isnSettings.ExternalUrl + "/index.json";
|
||||
NullThrottle throttle = new NullThrottle();
|
||||
|
||||
PackageSource packageSource = new PackageSource(pkgSourceUrl);
|
||||
HttpSource client = new HttpSource(packageSource, PkgSourceMessageHandler, throttle);
|
||||
NuGet.Protocol.RegistrationResourceV3 res = new NuGet.Protocol.RegistrationResourceV3(client ,
|
||||
new Uri(isnSettings.ExternalUrl + "/v3.4.0//registration"));
|
||||
}
|
||||
}
|
||||
|
||||
private Task<HttpHandlerResource> PkgSourceMessageHandler()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue