Okey
This commit is contained in:
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
@ -68,7 +68,7 @@
|
|||||||
"args": [
|
"args": [
|
||||||
"test",
|
"test",
|
||||||
"/property:GenerateFullPaths=true",
|
"/property:GenerateFullPaths=true",
|
||||||
"/consoleloggerparameters:NoSummary"
|
"--logger:xunit"
|
||||||
],
|
],
|
||||||
"problemMatcher": "$msCompile",
|
"problemMatcher": "$msCompile",
|
||||||
"dependsOn": [ "build", "copyTestConfig"]
|
"dependsOn": [ "build", "copyTestConfig"]
|
||||||
|
@ -22,13 +22,17 @@ namespace isnd.Controllers
|
|||||||
|
|
||||||
return Ok(packageManager.AutoComplete(id,skip,take,prerelease,packageType));
|
return Ok(packageManager.AutoComplete(id,skip,take,prerelease,packageType));
|
||||||
}
|
}
|
||||||
|
protected void CheckParams(int maxTake)
|
||||||
protected void CheckParams(int take,string semVerLevel)
|
|
||||||
{
|
{
|
||||||
if (take > maxTake)
|
if (maxTake > maxTake)
|
||||||
{
|
{
|
||||||
ModelState.AddModelError("take", "Maximum exceeded");
|
ModelState.AddModelError("take", "Maximum exceeded");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void CheckParams(int take, string semVerLevel)
|
||||||
|
{
|
||||||
|
CheckParams(take);
|
||||||
if (semVerLevel != PackageManager.BASE_API_LEVEL)
|
if (semVerLevel != PackageManager.BASE_API_LEVEL)
|
||||||
{
|
{
|
||||||
ModelState.AddModelError("semVerLevel", PackageManager.BASE_API_LEVEL + " expected");
|
ModelState.AddModelError("semVerLevel", PackageManager.BASE_API_LEVEL + " expected");
|
||||||
|
@ -32,8 +32,8 @@ namespace isnd.Controllers
|
|||||||
{
|
{
|
||||||
string pkgType = ParamHelpers.Optional(ref lower);
|
string pkgType = ParamHelpers.Optional(ref lower);
|
||||||
var pkgVersion = await dbContext.PackageVersions
|
var pkgVersion = await dbContext.PackageVersions
|
||||||
.Include(v => v.LatestCommit)
|
.Include(v => v.LatestCommit)
|
||||||
.SingleOrDefaultAsync(
|
.SingleOrDefaultAsync(
|
||||||
v => v.PackageId == id &&
|
v => v.PackageId == id &&
|
||||||
v.FullString == lower &&
|
v.FullString == lower &&
|
||||||
v.Type == pkgType
|
v.Type == pkgType
|
||||||
|
@ -40,7 +40,6 @@ namespace isnd.Data
|
|||||||
|
|
||||||
public string CommitId { get => CommitNId.ToString(); }
|
public string CommitId { get => CommitNId.ToString(); }
|
||||||
|
|
||||||
|
|
||||||
public virtual Commit LatestCommit{ get; set; }
|
public virtual Commit LatestCommit{ get; set; }
|
||||||
public string NugetLink => $"/package/{PackageId}/{FullString}/{PackageId}-{FullString}.nupkg";
|
public string NugetLink => $"/package/{PackageId}/{FullString}/{PackageId}-{FullString}.nupkg";
|
||||||
public string NuspecLink => $"/package/{PackageId}/{FullString}/{PackageId}-{FullString}.nuspec";
|
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; }
|
public static string ExternalAddress { get; internal set; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,6 +10,9 @@ using Microsoft.Extensions.Options;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using Microsoft.AspNetCore.Hosting.Server;
|
||||||
|
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace isnd.host.tests
|
namespace isnd.host.tests
|
||||||
{
|
{
|
||||||
@ -19,7 +22,7 @@ namespace isnd.host.tests
|
|||||||
public void TestHaveTestDbContextAndMigrate()
|
public void TestHaveTestDbContextAndMigrate()
|
||||||
{
|
{
|
||||||
string envVar = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
string envVar = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||||
|
|
||||||
IWebHost webhost = BuildWebHost(new string[0]);
|
IWebHost webhost = BuildWebHost(new string[0]);
|
||||||
|
|
||||||
using (var serviceScope = webhost.Services.CreateScope())
|
using (var serviceScope = webhost.Services.CreateScope())
|
||||||
@ -38,25 +41,35 @@ namespace isnd.host.tests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWebHost BuildWebHost(string[] args) =>
|
public static IWebHost BuildWebHost(string[] args) =>
|
||||||
WebHost.CreateDefaultBuilder(args)
|
WebHost.CreateDefaultBuilder(args)
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>().Build();
|
||||||
.Build();
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
||||||
public async Task NugetInstallsTest()
|
public async Task NugetInstallsTest()
|
||||||
{
|
{
|
||||||
IWebHost webhost = BuildWebHost(new string[0]);
|
|
||||||
Task running = Task.Run(async () => await webhost.StartAsync());
|
|
||||||
ProcessStartInfo psi = new ProcessStartInfo("nuget");
|
ProcessStartInfo psi = new ProcessStartInfo("nuget");
|
||||||
psi.ArgumentList.Add("install");
|
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);
|
Process p = Process.Start(psi);
|
||||||
p.WaitForExit();
|
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>
|
<Version>0.1.175</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="XunitXml.TestLogger" Version="3.0.70"/>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
||||||
<PackageReference Include="xunit" Version="2.4.1" />
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
@ -25,7 +26,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<MyTestingConfigFiles Include="appsettings.Testing.json" />
|
<MyTestingConfigFiles Include="appsettings.Testing.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Target Name="CopyTestConfig">
|
<!--
|
||||||
<Copy SourceFiles="@(MyTestingConfigFiles)" DestinationFolder="bin\Debug\net6.0" />
|
<Target Name="CopyTestConfig" AfterTargets="Build">
|
||||||
</Target>
|
<Copy SourceFiles="@(MyTestingConfigFiles)" DestinationFolder="$(OutputPath)" />
|
||||||
|
</Target>-->
|
||||||
</Project>
|
</Project>
|
Reference in New Issue
Block a user