Paul Schneider 5 years ago
parent 387f327717
commit 1c24ab4c01
7 changed files with 35 additions and 8 deletions

@ -52,3 +52,11 @@ release:
- make packages - make packages
deploy_staging:
stage: deploy
script:
- echo "Deploy to staging server"
environment:
name: staging
url: https://yavscpre.pschneider.fr

@ -16,7 +16,7 @@ using Microsoft.Data.Entity.Metadata.Conventions;
namespace test namespace test
{ {
[Trait("regres", "no")] [Trait("regression", "II")]
public class ServerSideFixture : IDisposable public class ServerSideFixture : IDisposable
{ {
SiteSettings _siteSetup; SiteSettings _siteSetup;
@ -99,27 +99,42 @@ namespace test
private readonly IHostingEngine hostengnine; private readonly IHostingEngine hostengnine;
void AssertNotNull(object obj, string msg)
{
if (obj == null)
throw new Exception(msg);
}
// //
public ServerSideFixture() public ServerSideFixture()
{ {
host = new WebHostBuilder(); host = new WebHostBuilder();
AssertNotNull(host, nameof(host));
hostengnine = host hostengnine = host
.UseEnvironment("Development") .UseEnvironment("Development")
.UseServer("test") .UseServer("test")
.UseStartup<test.Startup>() .UseStartup<test.Startup>()
.Build(); .Build();
AssertNotNull(hostengnine, nameof(hostengnine));
App = hostengnine.Start(); App = hostengnine.Start();
AssertNotNull(App, nameof(App));
// hostengnine.ApplicationServices // hostengnine.ApplicationServices
_mailer = App.Services.GetService(typeof(EMailer)) as EMailer; _mailer = App.Services.GetService(typeof(EMailer)) as EMailer;
AssertNotNull(_mailer, nameof(_mailer));
MailSender = App.Services.GetService(typeof(IEmailSender)) as IEmailSender;
AssertNotNull(MailSender, nameof(MailSender));
_loggerFactory = App.Services.GetService(typeof(ILoggerFactory)) as ILoggerFactory; _loggerFactory = App.Services.GetService(typeof(ILoggerFactory)) as ILoggerFactory;
AssertNotNull(_loggerFactory, nameof(_loggerFactory));
var siteSetup = App.Services.GetService(typeof(IOptions<SiteSettings>)) as IOptions<SiteSettings>; var siteSetup = App.Services.GetService(typeof(IOptions<SiteSettings>)) as IOptions<SiteSettings>;
AssertNotNull(siteSetup, nameof(siteSetup));
var testingSetup = App.Services.GetService(typeof(IOptions<Testing>)) as IOptions<Testing>; var testingSetup = App.Services.GetService(typeof(IOptions<Testing>)) as IOptions<Testing>;
MailSender = App.Services.GetService(typeof(IEmailSender)) as IEmailSender;
DbContext = App.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; DbContext = App.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
SiteSetup = siteSetup.Value; SiteSetup = siteSetup.Value;

@ -6,7 +6,7 @@ using Yavsc.Helpers;
namespace test namespace test
{ {
[Collection("Yavsc Abstract tests")] [Collection("Yavsc Abstract tests")]
[Trait("regression", "non")] [Trait("regression", "II")]
public class AbstractTests public class AbstractTests
{ {
readonly ITestOutputHelper output; readonly ITestOutputHelper output;

@ -5,7 +5,7 @@ using Xunit.Abstractions;
namespace test.Mandatory namespace test.Mandatory
{ {
[Collection("Database")] [Collection("Database")]
[Trait("regression", "non")] [Trait("regression", "II")]
[Trait("dev", "wip")] [Trait("dev", "wip")]
public class Database: IClassFixture<ServerSideFixture>, IDisposable public class Database: IClassFixture<ServerSideFixture>, IDisposable
{ {

@ -7,7 +7,7 @@ namespace test
{ {
[Collection("EMaillingTeststCollection")] [Collection("EMaillingTeststCollection")]
[Trait("regression", "non")] [Trait("regression", "II")]
public class EMaillingTests : IClassFixture<ServerSideFixture> public class EMaillingTests : IClassFixture<ServerSideFixture>
{ {

@ -10,7 +10,7 @@ namespace test
/// Since node isn't any requirement by here, /// Since node isn't any requirement by here,
/// It may regress /// It may regress
/// </summary> /// </summary>
[Trait("regression", "oui")] [Trait("regression", "allways")]
public class NodeTests public class NodeTests
{ {
void TestNodeJsForAnsitohtml () void TestNodeJsForAnsitohtml ()

@ -47,6 +47,7 @@ using Microsoft.AspNet.DataProtection.Infrastructure;
using System.IO; using System.IO;
using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.AspNet.Identity.EntityFramework;
using Yavsc.Auth; using Yavsc.Auth;
using Yavsc.Lib;
namespace test namespace test
{ {
@ -114,7 +115,10 @@ namespace test
services.AddEntityFramework().AddNpgsql().AddDbContext<ApplicationDbContext>(); services.AddEntityFramework().AddNpgsql().AddDbContext<ApplicationDbContext>();
services.AddTransient((s) => new RazorTemplateEngine(s.GetService<RazorEngineHost>())); services.AddTransient((s) => new RazorTemplateEngine(s.GetService<RazorEngineHost>()));
services.AddLogging(); services.AddLogging();
services.AddTransient<ServerSideFixture>();
services.AddTransient<MailSender>(); services.AddTransient<MailSender>();
services.AddTransient<EMailer>();
services.AddLocalization(options => services.AddLocalization(options =>
{ {
options.ResourcesPath = "Resources"; options.ResourcesPath = "Resources";

Loading…