broken/ef
Paul Schneider 2 years ago
parent a11bab759e
commit 519a4fbd46
7 changed files with 37 additions and 19 deletions

@ -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");

@ -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
{ {
@ -41,22 +44,32 @@ 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>
Loading…