This commit is contained in:
Paul Schneider
2021-04-05 00:11:54 +01:00
parent 387f327717
commit 1c24ab4c01
7 changed files with 37 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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