net6
Paul Schneider 2 years ago
parent 70f6e411e5
commit 4f040be236
18 changed files with 144 additions and 99 deletions

@ -32,7 +32,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/isnd/bin/Debug/netcoreapp2.1/isnd.dll",
"program": "${workspaceFolder}/src/isnd/bin/Debug/net6.0/isnd.dll",
"args": [],
"cwd": "${workspaceFolder}/src/isnd",
"stopAtEntry": false,

@ -21,8 +21,7 @@
"build",
"/p:Configuration=Debug",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"--ignore-failed-sources"
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},

@ -2,7 +2,7 @@
<PropertyGroup>
<PackageVersion>1.0.1</PackageVersion>
<Version>1.0.7</Version>
<TargetFrameworks>net451; net472; net4.8; netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<NoWarn>NETSDK1138</NoWarn>
<AssemblyVersion>1.0.7.0</AssemblyVersion>
<FileVersion>1.0.7.0</FileVersion>
@ -10,6 +10,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.ComponentModel.DataAnnotations" Version="4.0.0.0"/>
</ItemGroup>
</Project>

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<RootNamespace>nuget_cli</RootNamespace>
<UserSecretsId>45b74c62-05bc-4603-95b4-3e80ae2fdf50</UserSecretsId>
<Version>1.0.7</Version>

@ -10,7 +10,7 @@ namespace isnd.Controllers
public class NewUpdateController : Controller
{
[Authorize(Policy = IsndConstants.RequireAdminPolicyName)]
public IActionResult NewRelease(NewReleaseInfo version)
public IActionResult NewRelease(NewReleaseInfo release)
{
throw new NotImplementedException("web hook");
}

@ -12,20 +12,14 @@ namespace isnd.Controllers
{
// https://docs.microsoft.com/en-us/nuget/api/catalog-resource#versioning
[HttpGet(_pkgRootPrefix + ApiConfig.Catalog)]
public IActionResult CatalogIndex()
public async Task<IActionResult> CatalogIndex()
{
return Ok(PackageManager.CurrentCatalogIndex);
return Ok(await packageManager.GetCatalogIndexAsync());
}
[HttpGet(_pkgRootPrefix + ApiConfig.CatalogPage + "-{id}")]
public IActionResult Index(string id)
{
// https://docs.microsoft.com/en-us/nuget/api/catalog-resource#versioning
return Ok(PackageManager.CurrentCatalogPages[int.Parse(id)]);
}
[HttpGet(_pkgRootPrefix + "{apiVersion}/" + ApiConfig.Registration + "/{id}/{lower}.json")]
public IActionResult CatalogRegistration(string apiVersion, string id, string lower)
public async Task<IActionResult> CatalogRegistration(string apiVersion, string id, string lower)
{
if (lower.Equals("index", System.StringComparison.InvariantCultureIgnoreCase))
{
@ -34,7 +28,7 @@ namespace isnd.Controllers
Query = id,
Prerelease = true
};
var index = packageManager.GetPackageRegistrationIndex(query);
var index = await packageManager.GetPackageRegistrationIndexAsync(query);
if (index == null) return NotFound();
// query.TotalHits = result.Items.Select(i=>i.Items.Length).Aggregate((a,b)=>a+b);
return Ok(index);

@ -178,7 +178,7 @@ namespace isnd.Controllers
}
await dbContext.SaveChangesAsync();
packageManager.ÛpdateCatalogFor(commit);
packageManager.ÛpdateCatalogForAsync(commit);
logger.LogInformation($"new paquet : {spec.Name}");
}

@ -47,7 +47,7 @@ namespace isnd.Data.Catalog
NuGetVersion upper = new NuGetVersion(0,0,0);
// Assert.True(items.All(p=>p.Id == id));
long commitMax = 0;
foreach (var p in items)
{
if (upper < p.NugetVersion) upper = p.NugetVersion;
@ -57,8 +57,11 @@ namespace isnd.Data.Catalog
foreach (var p in items)
{
if (lower > p.NugetVersion) lower = p.NugetVersion;
if (p.CommitNId>commitMax) commitMax = p.CommitNId;
}
Lower = lower.ToFullString();
Count = items.Count;
CommitId = commitMax.ToString();
}
/// <summary>

@ -12,6 +12,7 @@ namespace isnd.Data.Catalog
/// </summary>
/// <value></value>
[JsonProperty("@id")]
[JsonRequired]
public string Id { get; protected set; }
public RegistrationPageIndex()
@ -21,7 +22,9 @@ namespace isnd.Data.Catalog
public RegistrationPageIndex(string bid, string id, string dlBase, IEnumerable<Package> pkgs)
{
Items = new List<RegistrationPage>();
long cnid = 0;
var pkgsGroups = pkgs.GroupBy(l => l.Id);
// Pour tous les groupes par Id
foreach (var gsp in pkgsGroups)
@ -32,13 +35,23 @@ namespace isnd.Data.Catalog
foreach(var l in pkgsbi.Select(p => p.Versions))
{
versions.AddRange(l);
foreach (var pv in l)
{
if (pv.CommitNId> cnid)
{
cnid = pv.CommitNId;
}
}
}
Items.Add(new RegistrationPage(bid, gsp.Key, dlBase, versions));
}
CommitId = cnid.ToString();
Id = bid + $"/{id}/index.json";
Count = Items.Count;
}
[JsonProperty("count")]
public int Count { get => Items?.Count ?? 0; }
public int Count { get ; private set; }
[JsonProperty("items")]
public List<RegistrationPage> Items { get; set; }

@ -20,15 +20,15 @@ namespace isnd.Interfaces
string[] GetVersions(string pkgid, NuGetVersion parsedVersion, bool prerelease = false, string packageType = null, int skip = 0, int take = 25);
IEnumerable<Resource> GetResources(IUnleash unleashĈlient);
void ÛpdateCatalogFor(Commit commit);
Task<RegistrationPageIndex> ÛpdateCatalogForAsync(Commit commit);
Task<PackageDeletionReport> DeletePackageAsync(string pkgid, string version, string type);
Task<PackageDeletionReport> UserAskForPackageDeletionAsync(string userid, string pkgId, string lower, string type);
Task<PackageVersion> GetPackageAsync(string pkgid, string version, string type);
IEnumerable<PackageVersion> GetCatalogLeaf(string pkgId, string version, string pkgType);
IEnumerable<RegistrationLeaf> SearchById(string pkgId, string semver, string pkgType);
RegistrationPageIndex GetCatalogIndex();
RegistrationPageIndex GetPackageRegistrationIndex(RegistrationPageIndexQuery query);
Task<RegistrationPageIndex> GetCatalogIndexAsync();
Task<RegistrationPageIndex> GetPackageRegistrationIndexAsync(RegistrationPageIndexQuery query);
Task<RegistrationPageIndex> SearchPackageAsync(RegistrationPageIndexQuery query);
}

@ -31,7 +31,6 @@ namespace isnd.Services
this.dbContext = dbContext;
isndSettings = siteConfigOptionsOptions.Value;
extUrl = isndSettings.ExternalUrl + "/";
CurrentCatalogIndex = GetCatalogIndex();
}
public IEnumerable<Resource> GetResources(IUnleash unleashClient)
@ -55,9 +54,9 @@ namespace isnd.Services
{
Id = extUrl + ApiConfig.GetPackage,
Type = "PackageBaseAddress/3.0.0",
Comment = "Package Base Address service"
Comment = @"Package Base Address service - Base URL of where NuGet packages are stored, in the format https://<host>/nupkg/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg"
});
if (unleashClient.IsEnabled("pkg-autocomplete", true))
if (unleashClient.IsEnabled("pkg-autocomplete", false))
res.Add(
new Resource
{
@ -65,7 +64,7 @@ namespace isnd.Services
Type = "SearchAutocompleteService/" + BASE_API_LEVEL,
Comment = "Auto complete service"
});
if (unleashClient.IsEnabled("pkg-search", true))
if (unleashClient.IsEnabled("pkg-search", false))
res.Add(
new Resource
{
@ -73,7 +72,7 @@ namespace isnd.Services
Type = "SearchQueryService/" + BASE_API_LEVEL,
Comment = "Search Query service"
});
if (unleashClient.IsEnabled("pkg-catalog", true))
if (unleashClient.IsEnabled("pkg-catalog", false))
res.Add(
new Resource
{
@ -86,7 +85,7 @@ namespace isnd.Services
res.Add(
new Resource
{
Id = extUrl + "v" + BASE_API_LEVEL + "/" + ApiConfig.Registration,
Id = extUrl + "v3.0.0/" + ApiConfig.Registration,
Type = "RegistrationsBaseUrl",
Comment = "Base URL of storage where isn package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
});
@ -161,32 +160,27 @@ namespace isnd.Services
.Skip(skip).Take(take).ToArray();
}
public static RegistrationPageIndex CurrentCatalogIndex { get; protected set; }
public static List<RegistrationPage> CurrentCatalogPages { get; protected set; }
public string CatalogBaseUrl => extUrl;
private IsndSettings isndSettings;
private string extUrl;
public virtual RegistrationPageIndex GetCatalogIndex()
public virtual async Task<RegistrationPageIndex>GetCatalogIndexAsync()
{
if (CurrentCatalogIndex == null)
{
ÛpdateCatalogFor();
}
return CurrentCatalogIndex;
return await ÛpdateCatalogForAsync(null);
}
public void ÛpdateCatalogFor(Commit reason = null)
public async Task<RegistrationPageIndex> ÛpdateCatalogForAsync(Commit reason = null)
{
int i = 0;
var oldIndex = CurrentCatalogIndex;
var oldPages = CurrentCatalogPages;
string baseid = extUrl + ApiConfig.Catalog;
string bidreg = $"{extUrl}v3.4.0/{ApiConfig.Registration}";
string basepageid = extUrl + ApiConfig.CatalogPage;
CurrentCatalogIndex = new RegistrationPageIndex();
CurrentCatalogPages = new List<RegistrationPage>();
RegistrationPageIndex CurrentCatalogIndex = new RegistrationPageIndex();
List<RegistrationPage> CurrentCatalogPages = new List<RegistrationPage>();
var scope = dbContext.Commits.OrderBy(c => c.TimeStamp);
@ -210,13 +204,12 @@ namespace isnd.Services
CurrentCatalogIndex.Items.Add(pageRef);
i = 0;
}
var validPkgs = dbContext.Packages
var validPkgs = dbContext.Packages
.Include(po => po.Owner)
.Include(pkg => pkg.Versions)
.Include(pkg => pkg.LatestVersion)
.Where(
pkg => pkg.Versions.Count(v => v.CommitId == commit.CommitId) > 0
).GroupBy((q) => q.Id);
.ToList()
.GroupBy((q) => q.Id);
// pkg.Versions.OrderByDescending(vi => vi.CommitNId).First().FullString
foreach (var pkgid in validPkgs)
{
@ -251,6 +244,7 @@ namespace isnd.Services
// From a fresh db
CurrentCatalogIndex.CommitId = "none";
}
return CurrentCatalogIndex;
}
public async Task<PackageDeletionReport> DeletePackageAsync(string pkgid, string version, string type)
@ -273,7 +267,7 @@ namespace isnd.Services
}
dbContext.PackageVersions.Remove(pkg);
await dbContext.SaveChangesAsync();
ÛpdateCatalogFor(commit);
await ÛpdateCatalogForAsync(commit);
return new PackageDeletionReport { Deleted = true, DeletedVersion = pkg };
}
@ -330,13 +324,11 @@ namespace isnd.Services
&& (pkgType == null || pkgType == v.Type));
}
public RegistrationPageIndex GetPackageRegistrationIndex(RegistrationPageIndexQuery query)
public async Task<RegistrationPageIndex> GetPackageRegistrationIndexAsync(RegistrationPageIndexQuery query)
{
// RegistrationPageIndexAndQuery
var scope = dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner)
.Where(p => p.Id.Equals(query.Query, StringComparison.InvariantCultureIgnoreCase)
&& (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease))
&& p.Versions.Count() > 0);
var scope = (await dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner)
.ToListAsync()) .Where(p => MatchingExact(p, query));
var total = scope.Count();
var pkgs = scope.Skip(query.Skip).Take(query.Take).ToArray();
string bid = $"{extUrl}v3.4.0/{ApiConfig.Registration}";
@ -346,17 +338,30 @@ namespace isnd.Services
public async Task<RegistrationPageIndex> SearchPackageAsync(RegistrationPageIndexQuery query)
{
string bid = $"{extUrl}v3.4.0/{ApiConfig.Registration}";
// RegistrationPageIndexAndQuery
if (query.Query == null) query.Query = "";
var scope = dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner)
.Where(p => p.Id.StartsWith(query.Query, StringComparison.InvariantCultureIgnoreCase)
&& (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease)))
.Where(p => p.Versions.Count>0);
var total = await scope.CountAsync();
var pkgs = await scope.Skip(query.Skip).Take(query.Take).ToArrayAsync();
var scope = (await dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner)
.ToListAsync())
.Where(p => Matching(p,query))
;
var total = scope.Count();
var pkgs = scope.Skip(query.Skip).Take(query.Take);
return
new RegistrationPageIndex(bid, query.Query, extUrl, pkgs);
}
private static bool MatchingExact(Package p, RegistrationPageIndexQuery query)
{
return
p.Id.Equals(query.Query, StringComparison.InvariantCultureIgnoreCase)
&& (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease));
}
private static bool Matching(Package p, RegistrationPageIndexQuery query)
{
return p.Id.StartsWith(query.Query, StringComparison.InvariantCultureIgnoreCase)
&& (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease));
}
}
}

@ -20,12 +20,13 @@ using Microsoft.IdentityModel.Tokens;
using System;
using Microsoft.OpenApi.Models;
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
namespace isnd
{
public class Startup
{
public static string ExternalAddress { get; internal set; }
public Startup(IConfiguration config)
{
@ -57,7 +58,7 @@ namespace isnd
.AddDefaultUI()
.AddDefaultTokenProviders();
services.AddMvc();
services.AddMvc(o=>o.EnableEndpointRouting = false);
services.AddDataProtection();
@ -90,12 +91,14 @@ namespace isnd
services.AddAuthentication("Bearer")
.AddJwtBearer("Bearer", options =>
{
options.Authority = ExternalAddress;
options.Authority = isndSettingsconf.GetValue<string>("ExternalUrl");
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateAudience = false
};
});
services.AddControllersWithViews();
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo
@ -122,8 +125,9 @@ namespace isnd
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app,
Microsoft.AspNetCore.Hosting.IHostingEnvironment env,
ApplicationDbContext dbContext)
IWebHostEnvironment env,
ApplicationDbContext dbContext,
IOptions<IsndSettings> isnSettingsOption )
{
if (env.IsDevelopment())
{
@ -139,12 +143,9 @@ namespace isnd
app.UseHsts();
dbContext.Database.Migrate();
}
app.UseStatusCodePages().UseStaticFiles().UseAuthentication().UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}");
});
app.UseStatusCodePages().UseStaticFiles().UseAuthentication();
app.UseMvcWithDefaultRoute();
}
}
}

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>85fd766d-5d23-4476-aed1-463b2942e86a</UserSecretsId>
<IsPackable>true</IsPackable>
<PackageLicenseExpression>WTFPL</PackageLicenseExpression>
@ -11,34 +11,36 @@
<Version>1.0.7</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.1.6" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="2.1.2" />
<PackageReference Include="Microsoft.AspNetCore.All" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="NuGet.Packaging.Core" Version="5.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.30" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.13" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.13">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.13" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.11" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.13" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.8" IncludeAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.13" />
<PackageReference Include="NuGet.Packaging.Core" Version="6.4.0" />
<PackageReference Include="MailKit" Version="2.8.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.1.2" IncludeAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.2" IncludeAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.3" IncludeAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.2" />
<PackageReference Include="unleash.client" Version="1.6.1" />
<PackageReference Include="GitVersion.MsBuild" Version="5.6.10*">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Antiforgery" Version="2.1.1" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Antiforgery" Version="2.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../isn.abst/isn.abst.csproj" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.2" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.1.0-preview1-final" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\LICENSE" Pack="true" PackagePath="LICENSE" />
</ItemGroup>

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<NoWarn>NETSDK1138</NoWarn>
<AssemblyVersion>1.0.7.0</AssemblyVersion>
@ -18,6 +18,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\isn\isn.csproj" />
<ProjectReference Include="..\..\src\isn.abstract\isn.abstract.csproj" />
<Reference Include="System.Net.Http" />
</ItemGroup>
</Project>

@ -11,6 +11,10 @@ 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
{
@ -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();
}
}
}

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Hosting.Server.Features;
@ -15,6 +16,8 @@ namespace isnd.tests
public class WebServerFixture : IDisposable
{
public IWebHost Host { get; private set;}
public List<string> Addresses { get; private set; } = new List<string>();
public WebServerFixture()
{
SetupHost();
@ -31,8 +34,7 @@ namespace isnd.tests
var webhostBuilder = new WebHostBuilder()
.UseKestrel()
.UseIISIntegration()
.UseContentRoot("../../../../../src/isnd"
)
// .UseContentRoot("../../../../../src/isnd")
.UseStartup(typeof(Startup))
.ConfigureAppConfiguration((builderContext, config) =>
{
@ -48,12 +50,14 @@ namespace isnd.tests
void PrintAddresses(IServiceProvider services)
{
Addresses.Clear();
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);
Addresses.Add(address);
}
}
}

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<UserSecretsId>d7144e46-4e63-4391-ba86-64b61f6e7be4</UserSecretsId>
<NoWarn>NETSDK1138</NoWarn>
@ -17,7 +17,6 @@
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.runner.reporters" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="Microsoft.AspNetCore.Antiforgery" Version="2.1.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\isnd\isnd.csproj" />

Loading…