Okey
This commit is contained in:
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
@ -68,7 +68,7 @@
|
||||
"args": [
|
||||
"test",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
"--logger:xunit"
|
||||
],
|
||||
"problemMatcher": "$msCompile",
|
||||
"dependsOn": [ "build", "copyTestConfig"]
|
||||
|
@ -22,13 +22,17 @@ namespace isnd.Controllers
|
||||
|
||||
return Ok(packageManager.AutoComplete(id,skip,take,prerelease,packageType));
|
||||
}
|
||||
|
||||
protected void CheckParams(int take,string semVerLevel)
|
||||
protected void CheckParams(int maxTake)
|
||||
{
|
||||
if (take > maxTake)
|
||||
if (maxTake > maxTake)
|
||||
{
|
||||
ModelState.AddModelError("take", "Maximum exceeded");
|
||||
}
|
||||
}
|
||||
|
||||
protected void CheckParams(int take, string semVerLevel)
|
||||
{
|
||||
CheckParams(take);
|
||||
if (semVerLevel != PackageManager.BASE_API_LEVEL)
|
||||
{
|
||||
ModelState.AddModelError("semVerLevel", PackageManager.BASE_API_LEVEL + " expected");
|
||||
|
@ -32,8 +32,8 @@ namespace isnd.Controllers
|
||||
{
|
||||
string pkgType = ParamHelpers.Optional(ref lower);
|
||||
var pkgVersion = await dbContext.PackageVersions
|
||||
.Include(v => v.LatestCommit)
|
||||
.SingleOrDefaultAsync(
|
||||
.Include(v => v.LatestCommit)
|
||||
.SingleOrDefaultAsync(
|
||||
v => v.PackageId == id &&
|
||||
v.FullString == lower &&
|
||||
v.Type == pkgType
|
||||
|
@ -40,7 +40,6 @@ namespace isnd.Data
|
||||
|
||||
public string CommitId { get => CommitNId.ToString(); }
|
||||
|
||||
|
||||
public virtual Commit LatestCommit{ get; set; }
|
||||
public string NugetLink => $"/package/{PackageId}/{FullString}/{PackageId}-{FullString}.nupkg";
|
||||
public string NuspecLink => $"/package/{PackageId}/{FullString}/{PackageId}-{FullString}.nuspec";
|
||||
|
@ -96,7 +96,7 @@ namespace isnd
|
||||
}
|
||||
|
||||
|
||||
public static IUnleash UnleashĈlient { get; private set; }
|
||||
public static IUnleash UnleashClient { get; private set; }
|
||||
public static string ExternalAddress { get; internal set; }
|
||||
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
@ -41,22 +44,32 @@ 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