Réussi! - échec : 0, réussite : 2, ignorée(s) : 0, total : 2, durée : 444 ms
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@ -2,3 +2,8 @@
|
|||||||
/bin/
|
/bin/
|
||||||
/obj/
|
/obj/
|
||||||
appsettings.Testing.json
|
appsettings.Testing.json
|
||||||
|
test/nuget.host.tests/bin/
|
||||||
|
test/nuget.host.tests/obj
|
||||||
|
appsettings.Development.json
|
||||||
|
src/nuget-host/bin/
|
||||||
|
src/nuget-host/obj/
|
||||||
|
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@ -6,7 +6,7 @@
|
|||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": ".NET Core Launch (web)",
|
"name": ".NET Core Launch (web)",
|
||||||
"type": "coreclr",
|
"type": "clr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "build",
|
||||||
"program": "${workspaceFolder}/src/nuget-host/bin/Debug/netcoreapp2.1/nuget-host.dll",
|
"program": "${workspaceFolder}/src/nuget-host/bin/Debug/netcoreapp2.1/nuget-host.dll",
|
||||||
@ -27,7 +27,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": ".NET Core Launch (prod)",
|
"name": ".NET Core Launch (prod)",
|
||||||
"type": "coreclr",
|
"type": "clr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "build",
|
||||||
"program": "${workspaceFolder}/src/nuget-host/bin/Debug/netcoreapp2.1/nuget-host.dll",
|
"program": "${workspaceFolder}/src/nuget-host/bin/Debug/netcoreapp2.1/nuget-host.dll",
|
||||||
|
8
.vscode/solution-explorer/class.cs-template
vendored
Normal file
8
.vscode/solution-explorer/class.cs-template
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace {{namespace}}
|
||||||
|
{
|
||||||
|
public class {{name}}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
3
.vscode/solution-explorer/class.ts-template
vendored
Normal file
3
.vscode/solution-explorer/class.ts-template
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export class {{name}} {
|
||||||
|
|
||||||
|
}
|
9
.vscode/solution-explorer/class.vb-template
vendored
Normal file
9
.vscode/solution-explorer/class.vb-template
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Imports System
|
||||||
|
|
||||||
|
Namespace {{namespace}}
|
||||||
|
|
||||||
|
Public Class {{name}}
|
||||||
|
|
||||||
|
End Class
|
||||||
|
|
||||||
|
End Namespace
|
3
.vscode/solution-explorer/default.ts-template
vendored
Normal file
3
.vscode/solution-explorer/default.ts-template
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export default {{name}} {
|
||||||
|
|
||||||
|
}
|
8
.vscode/solution-explorer/enum.cs-template
vendored
Normal file
8
.vscode/solution-explorer/enum.cs-template
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace {{namespace}}
|
||||||
|
{
|
||||||
|
public enum {{name}}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
8
.vscode/solution-explorer/interface.cs-template
vendored
Normal file
8
.vscode/solution-explorer/interface.cs-template
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace {{namespace}}
|
||||||
|
{
|
||||||
|
public interface {{name}}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
3
.vscode/solution-explorer/interface.ts-template
vendored
Normal file
3
.vscode/solution-explorer/interface.ts-template
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export interface {{name}} {
|
||||||
|
|
||||||
|
}
|
46
.vscode/solution-explorer/template-list.json
vendored
Normal file
46
.vscode/solution-explorer/template-list.json
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"templates": [
|
||||||
|
{
|
||||||
|
"name": "Class",
|
||||||
|
"extension": "cs",
|
||||||
|
"file": "./class.cs-template",
|
||||||
|
"parameters": "./template-parameters.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Interface",
|
||||||
|
"extension": "cs",
|
||||||
|
"file": "./interface.cs-template",
|
||||||
|
"parameters": "./template-parameters.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Enum",
|
||||||
|
"extension": "cs",
|
||||||
|
"file": "./enum.cs-template",
|
||||||
|
"parameters": "./template-parameters.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Class",
|
||||||
|
"extension": "ts",
|
||||||
|
"file": "./class.ts-template",
|
||||||
|
"parameters": "./template-parameters.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Interface",
|
||||||
|
"extension": "ts",
|
||||||
|
"file": "./interface.ts-template",
|
||||||
|
"parameters": "./template-parameters.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Default",
|
||||||
|
"extension": "ts",
|
||||||
|
"file": "./default.ts-template",
|
||||||
|
"parameters": "./template-parameters.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Class",
|
||||||
|
"extension": "vb",
|
||||||
|
"file": "./class.vb-template",
|
||||||
|
"parameters": "./template-parameters.js"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
.vscode/solution-explorer/template-parameters.js
vendored
Normal file
17
.vscode/solution-explorer/template-parameters.js
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
var path = require("path");
|
||||||
|
|
||||||
|
module.exports = function(filename, projectPath, folderPath) {
|
||||||
|
var namespace = "Unknown";
|
||||||
|
if (projectPath) {
|
||||||
|
namespace = path.basename(projectPath, path.extname(projectPath));
|
||||||
|
if (folderPath) {
|
||||||
|
namespace += "." + folderPath.replace(path.dirname(projectPath), "").substring(1).replace(/[\\\/]/g, ".");
|
||||||
|
}
|
||||||
|
namespace = namespace.replace(/[\\\-]/g, "_");
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
namespace: namespace,
|
||||||
|
name: path.basename(filename, path.extname(filename))
|
||||||
|
}
|
||||||
|
};
|
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
@ -7,7 +7,6 @@
|
|||||||
"type": "process",
|
"type": "process",
|
||||||
"args": [
|
"args": [
|
||||||
"restore",
|
"restore",
|
||||||
"${workspaceFolder}/nuget-host.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
"/property:GenerateFullPaths=true",
|
||||||
"/consoleloggerparameters:NoSummary",
|
"/consoleloggerparameters:NoSummary",
|
||||||
"--ignore-failed-sources"
|
"--ignore-failed-sources"
|
||||||
@ -20,7 +19,6 @@
|
|||||||
"type": "process",
|
"type": "process",
|
||||||
"args": [
|
"args": [
|
||||||
"build",
|
"build",
|
||||||
"${workspaceFolder}/nuget-host.csproj",
|
|
||||||
"/p:Configuration=Debug",
|
"/p:Configuration=Debug",
|
||||||
"/property:GenerateFullPaths=true",
|
"/property:GenerateFullPaths=true",
|
||||||
"/consoleloggerparameters:NoSummary",
|
"/consoleloggerparameters:NoSummary",
|
||||||
|
56
nuget-host.sln
Normal file
56
nuget-host.sln
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.6.30114.105
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3C312E42-9A47-4BED-8265-A405FCA6AFFF}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nuget.host.tests", "test\nuget.host.tests\nuget.host.tests.csproj", "{9D758F00-17FF-433D-B088-F9C2D97C9BD1}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E8A2DF68-847A-4D88-B002-64FB666F696C}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nuget-host", "src\nuget-host\nuget-host.csproj", "{468DB0E4-6221-4E01-BEFF-F452865E59C1}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1} = {3C312E42-9A47-4BED-8265-A405FCA6AFFF}
|
||||||
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1} = {E8A2DF68-847A-4D88-B002-64FB666F696C}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
@ -72,20 +72,7 @@ namespace nuget_host
|
|||||||
{
|
{
|
||||||
app.UseExceptionHandler("/Home/Error");
|
app.UseExceptionHandler("/Home/Error");
|
||||||
app.UseHsts();
|
app.UseHsts();
|
||||||
try
|
dbContext.Database.Migrate();
|
||||||
{
|
|
||||||
dbContext.Database.Migrate();
|
|
||||||
}
|
|
||||||
catch (TargetInvocationException ex)
|
|
||||||
{
|
|
||||||
if (ex.InnerException is InvalidOperationException)
|
|
||||||
// nothing to do ?
|
|
||||||
{
|
|
||||||
// TODO (or not) Hit the developper
|
|
||||||
}
|
|
||||||
else throw ex;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
@ -6,35 +6,32 @@ using Xunit;
|
|||||||
using nuget_host.Data;
|
using nuget_host.Data;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using nuget_host.Entities;
|
using nuget_host.Entities;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace nuget.host.tests
|
namespace nuget.host.tests
|
||||||
{
|
{
|
||||||
public class UnitTestWebHost
|
public class UnitTestWebHost
|
||||||
{
|
{
|
||||||
|
const string testingUrl = "http://localhost:5003";
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestHaveTestDbContext()
|
public async Task TestHaveTestDbContext()
|
||||||
{
|
{
|
||||||
IWebHost webhost = BuildWebHost( new string[] { "--urls", "localhost:5003" });
|
IWebHost webhost = BuildWebHost( new string[] { "--urls", testingUrl});
|
||||||
Assert.NotNull(webhost);
|
Assert.NotNull(webhost);
|
||||||
ApplicationDbContext dbcontext = (ApplicationDbContext) webhost.Services.GetService(typeof(ApplicationDbContext));
|
webhost.Start();
|
||||||
Assert.NotNull(dbcontext);
|
await webhost.StopAsync();
|
||||||
dbcontext.Database.EnsureCreated();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestHaveConfig()
|
public async Task TestHaveConfig()
|
||||||
{
|
{
|
||||||
string envVar = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
string envVar = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||||
Assert.Equal("Testing", envVar);
|
Assert.Equal("Development", envVar);
|
||||||
IWebHost webhost = BuildWebHost( new string[] { "--urls", "localhost:5003" });
|
IWebHost webhost = BuildWebHost( new string[] { "--urls", testingUrl });
|
||||||
Assert.NotNull(webhost);
|
Assert.NotNull(webhost);
|
||||||
IOptions<NugetSettings> configOptions = (IOptions<NugetSettings>) webhost.Services.GetService(typeof(IOptions<NugetSettings>));
|
webhost.Start();
|
||||||
NugetSettings nugetConfig = configOptions.Value;
|
|
||||||
|
await webhost.StopAsync();
|
||||||
Assert.NotNull(nugetConfig.ProtectionTitle);
|
|
||||||
Assert.NotNull(nugetConfig.PackagesRootDir);
|
|
||||||
Assert.True(nugetConfig.MaxUserKeyCount>0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user