bug rename seance
This commit is contained in:
parent
ccc91bbf19
commit
2def20d16f
384 changed files with 686 additions and 570 deletions
26
src/test/BaseTestContext.cs
Normal file
26
src/test/BaseTestContext.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using Microsoft.Dnx.Compilation.CSharp;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace test
|
||||
{
|
||||
public class BaseTestContext {
|
||||
|
||||
protected IApplicationEnvironment applicationEnvironment = null;
|
||||
protected IServiceProvider serviceProvider = null;
|
||||
protected IConfigurationRoot configurationRoot;
|
||||
protected BeforeCompileContext beforeCompileContext;
|
||||
protected IServiceProvider provider;
|
||||
protected IConfigurationRoot configuration;
|
||||
protected readonly ITestOutputHelper _output;
|
||||
protected ServerSideFixture _serverFixture;
|
||||
|
||||
public BaseTestContext(ITestOutputHelper output, ServerSideFixture serverFixture)
|
||||
{
|
||||
this._output = output;
|
||||
this._serverFixture = serverFixture;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/test/Makefile
Normal file
35
src/test/Makefile
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
CONFIGURATION=Debug
|
||||
BINTARGET=bin/$(CONFIGURATION)/dnx451/test.dll
|
||||
|
||||
all: test
|
||||
|
||||
project.lock.json: project.json
|
||||
dnu restore
|
||||
|
||||
../Yavsc/bin/$(CONFIGURATION)/dnx451/Yavsc.dll:
|
||||
make -C ../Yavsc
|
||||
|
||||
../Yavsc.Abstract/bin/$(CONFIGURATION)/dnx451/Yavsc.Abstract.dll:
|
||||
make -C ../Yavsc.Abstract
|
||||
|
||||
../Yavsc.Server/bin/$(CONFIGURATION)/dnx451/Yavsc.Server.dll:
|
||||
make -C ../Yavsc.Server
|
||||
|
||||
$(BINTARGET): project.lock.json ../Yavsc/bin/$(CONFIGURATION)/dnx451/Yavsc.dll ../Yavsc.Abstract/bin/$(CONFIGURATION)/dnx451/Yavsc.Abstract.dll ../Yavsc.Server/bin/$(CONFIGURATION)/dnx451/Yavsc.Server.dll
|
||||
dnu build --configuration $(CONFIGURATION)
|
||||
|
||||
breaking:
|
||||
dnx test -trait regres=yes
|
||||
|
||||
testdev: $(BINTARGET)
|
||||
ASPNET_ENV=Development dnx test -maxthreads 1 -trait dev=wip
|
||||
|
||||
|
||||
test: $(BINTARGET)
|
||||
ASPNET_ENV=Development dnx test -maxthreads 1 -trait regres=no
|
||||
|
||||
clean:
|
||||
rm -rf bin obj testingrepo
|
||||
|
||||
.PHONY: test
|
||||
|
||||
35
src/test/Mandatory/Database.cs
Normal file
35
src/test/Mandatory/Database.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace test.Mandatory
|
||||
{
|
||||
[Collection("EMaillingTeststCollection")]
|
||||
[Trait("regres", "no")]
|
||||
[Trait("dev", "wip")]
|
||||
public class Database: IClassFixture<ServerSideFixture>
|
||||
{
|
||||
ServerSideFixture _serverFixture;
|
||||
ITestOutputHelper output;
|
||||
public Database(ServerSideFixture serverFixture, ITestOutputHelper output)
|
||||
{
|
||||
this.output = output;
|
||||
_serverFixture = serverFixture;
|
||||
|
||||
output.WriteLine($"Startup.TestDbSettings.Database was {Startup.TestDbSettings.Database}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assuming we're using an account that may create databases,
|
||||
/// Install all our migrations in a fresh new database.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void InstallFromScratchUsingPoweredNpgsqlUser()
|
||||
{
|
||||
if (_serverFixture.DbCreated)
|
||||
_serverFixture.DropTestDb();
|
||||
|
||||
_serverFixture.CreateTestDb();
|
||||
_serverFixture.UpgradeDb();
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/test/Mandatory/EMailling.cs
Normal file
44
src/test/Mandatory/EMailling.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Yavsc.Abstract.Manage;
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
[Collection("EMaillingTeststCollection")]
|
||||
[Trait("regres", "no")]
|
||||
public class EMaillingTests : IClassFixture<ServerSideFixture>
|
||||
|
||||
{
|
||||
ServerSideFixture _serverFixture;
|
||||
ITestOutputHelper output;
|
||||
ILogger _logger;
|
||||
public EMaillingTests(ServerSideFixture serverFixture, ITestOutputHelper output)
|
||||
{
|
||||
this.output = output;
|
||||
_serverFixture = serverFixture;
|
||||
_logger = serverFixture.Logger;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SendEMailSynchrone()
|
||||
{
|
||||
|
||||
AssertAsync.CompletesIn(2, () =>
|
||||
{
|
||||
output.WriteLine("SendEMailSynchrone ...");
|
||||
EmailSentViewModel mailSentInfo = _serverFixture.MailSender.SendEmailAsync
|
||||
(_serverFixture.SiteSetup.Owner.Name, _serverFixture.SiteSetup.Owner.EMail, $"monthly email", "test boby monthly email").Result;
|
||||
if (mailSentInfo==null)
|
||||
_logger.LogError("No info on sending");
|
||||
else if (!mailSentInfo.Sent)
|
||||
_logger.LogError($"{mailSentInfo.ErrorMessage}");
|
||||
else
|
||||
_logger.LogInformation($"mailId:{mailSentInfo.MessageId} \nto:{_serverFixture.SiteSetup.Owner.Name}");
|
||||
Assert.NotNull(mailSentInfo);
|
||||
output.WriteLine($">>done with {mailSentInfo.EMail} {mailSentInfo.Sent} {mailSentInfo.MessageId} {mailSentInfo.ErrorMessage}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
60
src/test/Mandatory/NodeTests.cs
Executable file
60
src/test/Mandatory/NodeTests.cs
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using Xunit;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
[Trait("regres", "no")]
|
||||
public class NodeTests
|
||||
{
|
||||
[Fact]
|
||||
void TestNodeJsForAnsitohtml ()
|
||||
{
|
||||
var procStart = new ProcessStartInfo("node", "node_modules/ansi-to-html/bin/ansi-to-html");
|
||||
procStart.UseShellExecute = false;
|
||||
procStart.RedirectStandardInput = true;
|
||||
procStart.RedirectStandardOutput = true;
|
||||
procStart.RedirectStandardError = true;
|
||||
var proc = Process.Start(procStart);
|
||||
proc.StandardInput.WriteLine("\x001b[30mblack\x1b[37mwhite");
|
||||
proc.StandardInput.Close();
|
||||
while (!proc.StandardOutput.EndOfStream)
|
||||
{
|
||||
Console.Write(proc.StandardOutput.ReadToEnd());
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
void AnsiToHtml()
|
||||
{
|
||||
var procStart = new ProcessStartInfo("ls", "-l --color=always");
|
||||
procStart.UseShellExecute = false;
|
||||
procStart.RedirectStandardInput = false;
|
||||
procStart.RedirectStandardOutput = true;
|
||||
var proc = Process.Start(procStart);
|
||||
var encoded = GetStream(proc.StandardOutput);
|
||||
var reader = new StreamReader(encoded);
|
||||
var txt = reader.ReadToEnd();
|
||||
|
||||
Console.WriteLine(txt);
|
||||
}
|
||||
|
||||
public static Stream GetStream(StreamReader reader)
|
||||
{
|
||||
var procStart = new ProcessStartInfo("node", "node_modules/ansi-to-html/bin/ansi-to-html");
|
||||
procStart.UseShellExecute = false;
|
||||
procStart.RedirectStandardInput = true;
|
||||
procStart.RedirectStandardOutput = true;
|
||||
procStart.RedirectStandardError = true;
|
||||
var mem = new MemoryStream();
|
||||
StreamWriter writer = new StreamWriter(mem);
|
||||
var proc = Process.Start(procStart);
|
||||
var text = reader.ReadToEnd();
|
||||
proc.StandardInput.WriteLine(text);
|
||||
proc.StandardInput.Close();
|
||||
return proc.StandardOutput.BaseStream;
|
||||
}
|
||||
}
|
||||
}
|
||||
167
src/test/Mandatory/ServerSideFixture.cs
Normal file
167
src/test/Mandatory/ServerSideFixture.cs
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
using System;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.AspNet.Hosting.Internal;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Yavsc.Lib;
|
||||
using Yavsc.Services;
|
||||
using Yavsc;
|
||||
using Xunit;
|
||||
using Npgsql;
|
||||
|
||||
namespace test
|
||||
{
|
||||
[Trait("regres", "no")]
|
||||
public class ServerSideFixture : IDisposable {
|
||||
SiteSettings _siteSetup;
|
||||
ILogger _logger;
|
||||
IApplication _app;
|
||||
EMailer _mailer;
|
||||
ILoggerFactory _loggerFactory;
|
||||
IEmailSender _mailSender;
|
||||
public static string ApiKey => "53f4d5da-93a9-4584-82f9-b8fdf243b002" ;
|
||||
|
||||
public SiteSettings SiteSetup
|
||||
{
|
||||
get
|
||||
{
|
||||
return _siteSetup;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_siteSetup = value;
|
||||
}
|
||||
}
|
||||
|
||||
public IEmailSender MailSender
|
||||
{
|
||||
get
|
||||
{
|
||||
return _mailSender;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_mailSender = value;
|
||||
}
|
||||
}
|
||||
|
||||
public IApplication App
|
||||
{
|
||||
get
|
||||
{
|
||||
return _app;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_app = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal void UpgradeDb()
|
||||
{
|
||||
Microsoft.Data.Entity.Commands.Program.Main(
|
||||
new string [] { "database", "update" });
|
||||
}
|
||||
|
||||
public ILogger Logger
|
||||
{
|
||||
get
|
||||
{
|
||||
return _logger;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_logger = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool DbCreated { get; private set; }
|
||||
|
||||
//
|
||||
public ServerSideFixture()
|
||||
{
|
||||
InitTestHost();
|
||||
Logger.LogInformation("ServerSideFixture created.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
void InitTestHost()
|
||||
{
|
||||
|
||||
var host = new WebHostBuilder();
|
||||
|
||||
var hostengnine = host
|
||||
.UseEnvironment("Development")
|
||||
.UseServer("test")
|
||||
.UseStartup<test.Startup>()
|
||||
.Build();
|
||||
|
||||
App = hostengnine.Start();
|
||||
_mailer = App.Services.GetService(typeof(EMailer)) as EMailer;
|
||||
_loggerFactory = App.Services.GetService(typeof(ILoggerFactory)) as ILoggerFactory;
|
||||
|
||||
Logger = _loggerFactory.CreateLogger<ServerSideFixture> ();
|
||||
var siteSetup = App.Services.GetService(typeof(IOptions<SiteSettings>)) as IOptions<SiteSettings>;
|
||||
SiteSetup = siteSetup.Value;
|
||||
MailSender = App.Services.GetService(typeof(IEmailSender)) as IEmailSender;
|
||||
CheckDbExistence();
|
||||
if (!DbCreated)
|
||||
CreateTestDb();
|
||||
}
|
||||
|
||||
public void CreateTestDb()
|
||||
{
|
||||
if (!DbCreated)
|
||||
using (
|
||||
NpgsqlConnection cx = new NpgsqlConnection(Startup.DevDbSettings.ConnectionString))
|
||||
{
|
||||
cx.Open();
|
||||
var command = cx.CreateCommand();
|
||||
command.CommandText = $"create database \"{Startup.TestDbSettings.Database}\";";
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
_logger.LogInformation($"database created.");
|
||||
cx.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckDbExistence()
|
||||
{
|
||||
using (
|
||||
NpgsqlConnection cx = new NpgsqlConnection(Startup.DevDbSettings.ConnectionString))
|
||||
{
|
||||
cx.Open();
|
||||
var command = cx.CreateCommand();
|
||||
command.CommandText = $"SELECT 1 FROM pg_database WHERE datname='{Startup.TestDbSettings.Database}';";
|
||||
DbCreated = (command.ExecuteScalar()!=null);
|
||||
|
||||
_logger.LogInformation($"DbCreated:{DbCreated}");
|
||||
cx.Close();
|
||||
}
|
||||
}
|
||||
public void DropTestDb()
|
||||
{
|
||||
if (DbCreated)
|
||||
using (
|
||||
NpgsqlConnection cx = new NpgsqlConnection(Startup.DevDbSettings.ConnectionString))
|
||||
{
|
||||
cx.Open();
|
||||
var command = cx.CreateCommand();
|
||||
command.CommandText = $"drop database \"{Startup.TestDbSettings.Database}\";";
|
||||
command.ExecuteNonQuery();
|
||||
_logger.LogInformation($"database dropped");
|
||||
cx.Close();
|
||||
}
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
Logger.LogInformation("Disposing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
220
src/test/Mandatory/YavscMandatory.cs
Executable file
220
src/test/Mandatory/YavscMandatory.cs
Executable file
|
|
@ -0,0 +1,220 @@
|
|||
using System;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Builder.Internal;
|
||||
using Microsoft.AspNet.Razor;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using Xunit;
|
||||
using Yavsc;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Services;
|
||||
using System.Runtime.Versioning;
|
||||
using Microsoft.AspNet.Mvc.Razor;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Dnx.Compilation.CSharp;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Yavsc.Helpers;
|
||||
using Microsoft.Data.Entity;
|
||||
using Xunit.Abstractions;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Yavsc.Server.Models.IT.SourceCode;
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
|
||||
[Collection("Yavsc mandatory success story")]
|
||||
[Trait("regres", "no")]
|
||||
public class YavscMandatory: BaseTestContext, IClassFixture<ServerSideFixture>
|
||||
{
|
||||
|
||||
public YavscMandatory(ITestOutputHelper output, ServerSideFixture fixture) : base (output, fixture)
|
||||
{
|
||||
|
||||
}
|
||||
[Fact]
|
||||
public void GitClone()
|
||||
{
|
||||
|
||||
var dbc = _serverFixture.App.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
|
||||
|
||||
var firstProject = dbc.Projects.Include(p=>p.Repository).FirstOrDefault();
|
||||
Assert.NotNull (firstProject);
|
||||
|
||||
var clone = new GitClone(_serverFixture.SiteSetup.GitRepository);
|
||||
clone.Launch(firstProject);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
void AnsiToHtml()
|
||||
{
|
||||
var procStart = new ProcessStartInfo("ls", "-l --color=always");
|
||||
procStart.UseShellExecute = false;
|
||||
procStart.RedirectStandardInput = false;
|
||||
procStart.RedirectStandardOutput = true;
|
||||
var proc = Process.Start(procStart);
|
||||
var encoded = AnsiToHtmlEncoder.GetStream(proc.StandardOutput);
|
||||
using (var reader = new StreamReader(encoded))
|
||||
{
|
||||
var txt = reader.ReadToEnd();
|
||||
_output.WriteLine(txt);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ApplicationDbContextExists()
|
||||
{
|
||||
var dbc = new ApplicationDbContext();
|
||||
Assert.NotNull(dbc.GCMDevices);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MvcRazorHostAndParser()
|
||||
{
|
||||
string cache = System.IO.Directory.GetCurrentDirectory();
|
||||
MvcRazorHost host = new MvcRazorHost(cache);
|
||||
var parser = host.CreateMarkupParser();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
void HaveDependecyInjection()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
void HaveHost()
|
||||
{
|
||||
beforeCompileContext = CreateYavscCompilationContext();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AConfigurationRoot()
|
||||
{
|
||||
var builder = new ConfigurationBuilder();
|
||||
builder.AddJsonFile( "appsettings.json", false);
|
||||
builder.AddJsonFile( "appsettings.Development.json", true);
|
||||
configurationRoot = builder.Build();
|
||||
}
|
||||
|
||||
internal static BeforeCompileContext CreateYavscCompilationContext()
|
||||
{
|
||||
var projectContext = new ProjectContext();
|
||||
projectContext.Name = "Yavsc";
|
||||
projectContext.ProjectDirectory = "/home/paul/workspace/yavsc/Yavsc";
|
||||
projectContext.ProjectFilePath = "/home/paul/workspace/yavsc/Yavsc/project.json";
|
||||
projectContext.TargetFramework = new FrameworkName("DNX", new Version(4, 5, 1));
|
||||
projectContext.Configuration = "Development";
|
||||
|
||||
return new BeforeCompileContext(
|
||||
null, projectContext, () => null, () => null, () => null);
|
||||
}
|
||||
|
||||
internal static IConfigurationRoot CreateConfiguration(string prjDir)
|
||||
{
|
||||
var builder = new ConfigurationBuilder();
|
||||
|
||||
builder.AddJsonFile(Path.Combine(prjDir, "appsettings.json"), true);
|
||||
builder.AddJsonFile(Path.Combine(prjDir, "appsettings.Development.json"), true);
|
||||
return builder.Build();
|
||||
}
|
||||
|
||||
internal static void ConfigureServices
|
||||
(ServiceCollection serviceCollection,
|
||||
string prjDir,
|
||||
out IConfigurationRoot configuration,
|
||||
out IServiceProvider provider)
|
||||
{
|
||||
configuration = CreateConfiguration(prjDir);
|
||||
|
||||
serviceCollection.AddOptions();
|
||||
var siteSettingsconf = configuration.GetSection("Site");
|
||||
serviceCollection.Configure<SiteSettings>(siteSettingsconf);
|
||||
var smtpSettingsconf = configuration.GetSection("Smtp");
|
||||
serviceCollection.Configure<SmtpSettings>(smtpSettingsconf);
|
||||
var locOptions = configuration.GetSection("Localization");
|
||||
serviceCollection.Configure<LocalizationOptions>(locOptions);
|
||||
|
||||
serviceCollection.AddSingleton(typeof(ILoggerFactory), typeof(LoggerFactory));
|
||||
serviceCollection.AddTransient(typeof(IEmailSender), typeof(MailSender));
|
||||
serviceCollection.AddTransient(typeof(RazorEngineHost));
|
||||
serviceCollection.AddTransient((s) => new RazorTemplateEngine(s.GetService<RazorEngineHost>()));
|
||||
serviceCollection.AddLogging();
|
||||
serviceCollection.AddMvcCore();
|
||||
serviceCollection.AddLocalization(options =>
|
||||
{
|
||||
options.ResourcesPath = "Resources";
|
||||
});
|
||||
var connectionString = configuration["Data:DefaultConnection:ConnectionString"];
|
||||
AppDomain.CurrentDomain.SetData("YAVSC_DB_CONNECTION", connectionString);
|
||||
serviceCollection.AddEntityFramework()
|
||||
.AddNpgsql()
|
||||
.AddDbContext<ApplicationDbContext>(
|
||||
db => db.UseNpgsql(connectionString)
|
||||
);
|
||||
provider = serviceCollection.BuildServiceProvider();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void ARequestAppDelegate()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
|
||||
services.AddTransient<IRuntimeEnvironment>(
|
||||
svs => PlatformServices.Default.Runtime
|
||||
);
|
||||
|
||||
HaveHost();
|
||||
var prjDir = this.beforeCompileContext.ProjectContext.ProjectDirectory;
|
||||
ConfigureServices(services, prjDir, out configurationRoot, out serviceProvider);
|
||||
|
||||
IApplicationBuilder app = new ApplicationBuilder(serviceProvider);
|
||||
var rtd = app.Build();
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void MessageSenderFromLib()
|
||||
{
|
||||
ARequestAppDelegate();
|
||||
ILoggerFactory factory = ActivatorUtilities.GetServiceOrCreateInstance<ILoggerFactory>(serviceProvider);
|
||||
var dbc = new ApplicationDbContext();
|
||||
|
||||
IOptions<SiteSettings> siteOptions =
|
||||
ActivatorUtilities.GetServiceOrCreateInstance<IOptions<SiteSettings>>(serviceProvider);
|
||||
;
|
||||
IOptions<SmtpSettings> smtpOptions = ActivatorUtilities.GetServiceOrCreateInstance<IOptions<SmtpSettings>>(serviceProvider);
|
||||
;
|
||||
IOptions<GoogleAuthSettings> googleOptions = ActivatorUtilities.GetServiceOrCreateInstance<IOptions<GoogleAuthSettings>>(serviceProvider);
|
||||
;
|
||||
IEmailSender eSender = new MailSender
|
||||
(factory, siteOptions, smtpOptions, googleOptions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InitApplicationBuilder()
|
||||
{
|
||||
|
||||
var services = new ServiceCollection();
|
||||
|
||||
services.AddTransient<IRuntimeEnvironment>(
|
||||
svs => PlatformServices.Default.Runtime
|
||||
);
|
||||
beforeCompileContext = YavscMandatory.CreateYavscCompilationContext();
|
||||
var prjDir = beforeCompileContext.ProjectContext.ProjectDirectory;
|
||||
YavscMandatory.ConfigureServices(services, prjDir, out configuration, out provider);
|
||||
|
||||
IApplicationBuilder app = new ApplicationBuilder(provider);
|
||||
app.UseMvc();
|
||||
var rtd = app.Build();
|
||||
IOptions<LocalizationOptions> localOptions = ActivatorUtilities.GetServiceOrCreateInstance<IOptions<LocalizationOptions>>(provider); ;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/test/Settings/DbConnectionSettings.cs
Normal file
23
src/test/Settings/DbConnectionSettings.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
namespace test.Settings
|
||||
{
|
||||
public abstract class DbConnectionSettings
|
||||
{
|
||||
public string Database { get; set; }
|
||||
public string Server { get; set; }
|
||||
public int Port { get; set; }
|
||||
public string Username { get; set; }
|
||||
|
||||
public string ConnectionString => $"Database={Database};Server={Server};Port={Port};Username={Username};Password={Password};";
|
||||
|
||||
public string Password { get; set; }
|
||||
}
|
||||
|
||||
public class DevConnectionSettings : DbConnectionSettings
|
||||
{
|
||||
|
||||
}
|
||||
public class TestConnectionSettings : DbConnectionSettings
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
103
src/test/Startup.cs
Normal file
103
src/test/Startup.cs
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
using System;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.AspNet.Razor;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using Yavsc;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Services;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Extensions.WebEncoders;
|
||||
using Yavsc.Lib;
|
||||
using test.Settings;
|
||||
|
||||
namespace test
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
|
||||
public static IConfiguration Configuration { get; set; }
|
||||
|
||||
public static string HostingFullName { get; private set; }
|
||||
public static DbConnectionSettings DevDbSettings { get; private set; }
|
||||
public static DbConnectionSettings TestDbSettings { get; private set; }
|
||||
|
||||
ILogger logger;
|
||||
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
|
||||
{
|
||||
var devtag = env.IsDevelopment()?"D":"";
|
||||
var prodtag = env.IsProduction()?"P":"";
|
||||
var stagetag = env.IsStaging()?"S":"";
|
||||
|
||||
HostingFullName = $"{appEnv.RuntimeFramework.FullName} [{env.EnvironmentName}:{prodtag}{devtag}{stagetag}]";
|
||||
// Set up configuration sources.
|
||||
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddEnvironmentVariables()
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
|
||||
Configuration = builder.Build();
|
||||
}
|
||||
|
||||
public void ConfigureServices (IServiceCollection services)
|
||||
{
|
||||
services.AddOptions();
|
||||
var siteSettingsconf = Configuration.GetSection("Site");
|
||||
services.Configure<SiteSettings>(siteSettingsconf);
|
||||
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
||||
services.Configure<SmtpSettings>(smtpSettingsconf);
|
||||
var devCx = Configuration.GetSection("Data:DevConnection");
|
||||
services.Configure<DevConnectionSettings>(devCx);
|
||||
var testCx = Configuration.GetSection("Data:TestConnection");
|
||||
services.Configure<TestConnectionSettings>(testCx);
|
||||
|
||||
|
||||
services.AddInstance(typeof(ILoggerFactory), new LoggerFactory());
|
||||
services.AddTransient(typeof(IEmailSender), typeof(MailSender));
|
||||
services.AddEntityFramework().AddNpgsql().AddDbContext<ApplicationDbContext>();
|
||||
services.AddTransient((s) => new RazorTemplateEngine(s.GetService<RazorEngineHost>()));
|
||||
services.AddLogging();
|
||||
services.AddTransient<EMailer>();
|
||||
services.AddLocalization(options =>
|
||||
{
|
||||
options.ResourcesPath = "Resources";
|
||||
});
|
||||
|
||||
services.AddEntityFramework()
|
||||
.AddNpgsql()
|
||||
.AddDbContext<ApplicationDbContext>(
|
||||
db => db.UseNpgsql(Startup.TestDbSettings.ConnectionString)
|
||||
);
|
||||
|
||||
services.AddTransient<Microsoft.Extensions.WebEncoders.UrlEncoder, UrlEncoder>();
|
||||
|
||||
}
|
||||
|
||||
public void Configure (IApplicationBuilder app, IHostingEnvironment env,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
IOptions<TestConnectionSettings> testCxOptions,
|
||||
IOptions<DevConnectionSettings> devCxOptions,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||
loggerFactory.AddDebug();
|
||||
logger = loggerFactory.CreateLogger<Startup>();
|
||||
logger.LogInformation(env.EnvironmentName);
|
||||
|
||||
TestDbSettings = testCxOptions.Value;
|
||||
DevDbSettings = devCxOptions.Value;
|
||||
logger.LogInformation($"test db : {TestDbSettings.ConnectionString}");
|
||||
AppDomain.CurrentDomain.SetData("YAVSC_CONNECTION", TestDbSettings.ConnectionString);
|
||||
|
||||
var authConf = Configuration.GetSection("Authentication").GetSection("Yavsc");
|
||||
var clientId = authConf.GetSection("ClientId").Value;
|
||||
var clientSecret = authConf.GetSection("ClientSecret").Value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
33
src/test/TestHelpers.cs
Normal file
33
src/test/TestHelpers.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace test {
|
||||
|
||||
public static class AssertAsync {
|
||||
|
||||
public static void CompletesIn(int timeout, Action action)
|
||||
{
|
||||
var task = Task.Run(action);
|
||||
var completedInTime = Task.WaitAll(new[] { task }, TimeSpan.FromSeconds(timeout));
|
||||
|
||||
if (task.Exception != null)
|
||||
{
|
||||
if (task.Exception.InnerExceptions.Count == 1)
|
||||
{
|
||||
throw task.Exception.InnerExceptions[0];
|
||||
}
|
||||
|
||||
throw task.Exception;
|
||||
}
|
||||
|
||||
if (!completedInTime)
|
||||
{
|
||||
throw new TimeoutException($"Task did not complete in {timeout} seconds.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
47
src/test/WIP/NotWorking.cs
Normal file
47
src/test/WIP/NotWorking.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// // NotWorking.cs
|
||||
// /*
|
||||
// paul 21/06/2018 10:16 20182018 6 21
|
||||
// */
|
||||
using System;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Xunit;
|
||||
using Yavsc;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.Dnx.TestHost.TestAdapter;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace test
|
||||
{
|
||||
[Collection("Yavsc dropped intents")]
|
||||
[Trait("regres", "yes")]
|
||||
public class NotWorking : BaseTestContext
|
||||
{
|
||||
SourceInformationProvider _sourceInfoProvider;
|
||||
IOptions<LocalizationOptions> _localizationOptions;
|
||||
public NotWorking( IHostingEnvironment env , IOptions<SiteSettings> siteSettings,
|
||||
SourceInformationProvider sourceInfoProvider,
|
||||
IOptions<LocalizationOptions> localizationOptions,
|
||||
ServerSideFixture serverFixture, ITestOutputHelper output
|
||||
) : base (output, serverFixture) {
|
||||
_sourceInfoProvider = sourceInfoProvider;
|
||||
_localizationOptions = localizationOptions;
|
||||
}
|
||||
|
||||
public void StringLocalizer()
|
||||
{
|
||||
// TODO build applicationEnvironment
|
||||
ResourceManagerStringLocalizerFactory strFact = new ResourceManagerStringLocalizerFactory
|
||||
(applicationEnvironment, _localizationOptions);
|
||||
IStringLocalizer stringLocalizer = strFact.Create(typeof(NotWorking));
|
||||
}
|
||||
|
||||
public void NoDnxEnv()
|
||||
{
|
||||
|
||||
IOptions<LocalizationOptions> localOptions = Activator.CreateInstance<IOptions<LocalizationOptions>>();
|
||||
ResourceManagerStringLocalizerFactory strFact = new ResourceManagerStringLocalizerFactory(applicationEnvironment, localOptions);
|
||||
IStringLocalizer stringLocalizer = strFact.Create(typeof(NotWorking));
|
||||
}
|
||||
}
|
||||
}
|
||||
121
src/test/WIP/YavscWorkInProgress.cs
Normal file
121
src/test/WIP/YavscWorkInProgress.cs
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
// // YavscWorkInProgress.cs
|
||||
// /*
|
||||
// paul 21/06/2018 10:11 20182018 6 21
|
||||
// */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Yavsc.Authentication;
|
||||
using static OAuth.AspNet.AuthServer.Constants;
|
||||
|
||||
namespace test
|
||||
{
|
||||
[Collection("Yavsc Work In Progress")]
|
||||
[Trait("regres", "yes")]
|
||||
public class YavscWorkInProgress : BaseTestContext, IClassFixture<ServerSideFixture>
|
||||
{
|
||||
public YavscWorkInProgress(ServerSideFixture serverFixture, ITestOutputHelper output)
|
||||
: base(output, serverFixture)
|
||||
{
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(GetLoginIntentData), parameters: 1)]
|
||||
public async Task TestUserMayLogin
|
||||
(
|
||||
string clientId,
|
||||
string clientSecret,
|
||||
string scope,
|
||||
string authorizeUrl,
|
||||
string redirectUrl,
|
||||
string accessTokenUrl,
|
||||
string login,
|
||||
string pass
|
||||
)
|
||||
{
|
||||
try
|
||||
{
|
||||
var oauthor = new OAuthenticator(clientId, clientSecret, scope,
|
||||
new Uri(authorizeUrl), new Uri(redirectUrl), new Uri(accessTokenUrl));
|
||||
var query = new Dictionary<string, string>();
|
||||
query[Parameters.Username] = login;
|
||||
query[Parameters.Password] = pass;
|
||||
query[Parameters.GrantType] = GrantTypes.Password;
|
||||
var result = await oauthor.RequestAccessTokenAsync(query);
|
||||
Console.WriteLine(">> Got an output");
|
||||
Console.WriteLine(Parameters.AccessToken + ": " + result[Parameters.AccessToken]);
|
||||
Console.WriteLine(Parameters.TokenType + ": " + result[Parameters.TokenType]);
|
||||
Console.WriteLine(Parameters.ExpiresIn + ": " + result[Parameters.ExpiresIn]);
|
||||
Console.WriteLine(Parameters.RefreshToken + ": " + result[Parameters.RefreshToken]);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var webex = ex as WebException;
|
||||
if (webex != null && webex.Status == (WebExceptionStatus)400)
|
||||
{
|
||||
if (login == "joe")
|
||||
{
|
||||
Console.WriteLine("Bad pass joe!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public static string GetPassword()
|
||||
{
|
||||
var pwd = new StringBuilder();
|
||||
while (true)
|
||||
{
|
||||
var len = pwd.ToString().Length;
|
||||
ConsoleKeyInfo i = Console.ReadKey(true);
|
||||
if (i.Key == ConsoleKey.Enter)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (i.Key == ConsoleKey.Backspace)
|
||||
{
|
||||
if (pwd.Length > 0)
|
||||
{
|
||||
pwd.Remove(len - 1, 1);
|
||||
Console.Write("\b \b");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pwd.Append(i.KeyChar);
|
||||
Console.Write("*");
|
||||
}
|
||||
}
|
||||
return pwd.ToString();
|
||||
}
|
||||
public static IEnumerable<object[]> GetLoginIntentData(int numTests)
|
||||
{
|
||||
|
||||
var allData = new List<object[]>();
|
||||
Console.WriteLine($"Please, enter {numTests}:");
|
||||
|
||||
for (int iTest=0; iTest<numTests; iTest++)
|
||||
{
|
||||
Console.Write("Please, enter a login:");
|
||||
var login = Console.ReadLine();
|
||||
Console.Write("Please, enter a pass:");
|
||||
var pass = GetPassword();
|
||||
|
||||
allData.Add(new object[] { ServerSideFixture.ApiKey, "blouh", "profile",
|
||||
"http://localhost:5000/authorize", "http://localhost:5000/oauth/success",
|
||||
"http://localhost:5000/token",login, pass });
|
||||
}
|
||||
return allData.Take(numTests);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
23
src/test/YavscServerFactory.cs
Normal file
23
src/test/YavscServerFactory.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Hosting.Server;
|
||||
using Microsoft.AspNet.Http.Features;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Yavsc.Server
|
||||
{
|
||||
public class cliServerFactory : IServerFactory
|
||||
{
|
||||
public IFeatureCollection Initialize(IConfiguration configuration)
|
||||
{
|
||||
FeatureCollection featureCollection = new FeatureCollection();
|
||||
return featureCollection;
|
||||
}
|
||||
|
||||
public IDisposable Start(IFeatureCollection serverFeatures, Func<IFeatureCollection, Task> application)
|
||||
{
|
||||
var task = application(serverFeatures);
|
||||
return task;
|
||||
}
|
||||
}
|
||||
}
|
||||
112
src/test/appsettings.Development.json
Normal file
112
src/test/appsettings.Development.json
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
{
|
||||
"Site": {
|
||||
"Authority": "dev.pschneider.fr",
|
||||
"Title": "Yavsc dev",
|
||||
"Slogan": "Yavsc : WIP.",
|
||||
"Banner": "/images/yavsc.png",
|
||||
"HomeViewName": "Home",
|
||||
"FavIcon": "/favicon.ico",
|
||||
"Icon": "/images/yavsc.png",
|
||||
"Owner": {
|
||||
"Name": "Paul",
|
||||
"EMail": "paul@pschneider.fr",
|
||||
"PostalAddress": {
|
||||
"Street1": "Rua Professor Miguel Telles Antunès",
|
||||
"Street2": "2 H",
|
||||
"PostalCode": "2530-146",
|
||||
"City": "Lourinha",
|
||||
"State": "Portugal",
|
||||
"Province": null
|
||||
}
|
||||
},
|
||||
"Admin": {
|
||||
"Name": "Paul",
|
||||
"EMail": "contact@pschneider.fr"
|
||||
},
|
||||
"Avatars": "Avatars-Dev",
|
||||
"Quota": 200000000,
|
||||
"Bills": "Bills-Dev",
|
||||
"Blog": "Blog-Test",
|
||||
"TempDir": "Temp-Test"
|
||||
},
|
||||
"Smtp": {
|
||||
"Host": "127.0.0.1",
|
||||
"Port": 25,
|
||||
"EnableSSL": false
|
||||
},
|
||||
"Logging": {
|
||||
"IncludeScopes": true,
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Warning",
|
||||
"Microsoft": "Warning"
|
||||
}
|
||||
},
|
||||
"Data": {
|
||||
"DevConnection": {
|
||||
"Database":"postgres",
|
||||
"Server": "localhost",
|
||||
"Port": 5432,
|
||||
"Username": "yavscdev",
|
||||
"Password": "admin"
|
||||
},
|
||||
"TestConnection": {
|
||||
"Database":"YavscTest",
|
||||
"Server": "localhost",
|
||||
"Port": 5432,
|
||||
"Username": "yavscdev",
|
||||
"Password": "admin"
|
||||
}
|
||||
},
|
||||
"Authentication": {
|
||||
"Google": {
|
||||
"ApiKey": "AIzaSyCF7Bgz-W_p26bbMzxp1ukdgg3LMDHzAo0",
|
||||
"ClientId": "325408689282-6bekh7p3guj4k0f3301a6frf025cnrk1.apps.googleusercontent.com",
|
||||
"ClientSecret": "MaxYcvJJCs2gDGvaELZbzwfL",
|
||||
"BrowserApiKey": "AIzaSyATlg-wFCJXW658LfgqE1hm-R0tqPdwyNQ",
|
||||
"Account": {
|
||||
"project_id": "yavsc-001",
|
||||
"private_key_id": "1b129fdf289992810a2a1ff9cb2741e24581dc1c",
|
||||
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCLmo3mv/hrpYkv\nQIr2Imrj84W2IRxJQ0RXJmMTe+qZkqZoCxVHjbwNaFBAP4GhpdQI3KcWc24bTyc0\n8EqlXPvGXTvm/GvWy+TUECW2d1faV6vYv0i/Mllypw5Dd3MduCcE/jethDyNC1rQ\n+pWEZqs4P4PGMiDOTI8I+tsPKlCX+ODNBpZDa75DfPi2qsus+wJsTyq/Ee3JyHDQ\nKPpxTAOYVc8f02Y1HTS75EMAIQt4dZgMSvvrzUiYfoBLoBGPOSPpXgD1kTagdmQW\nVFCL0rSSd2Ok/9ATlumFc/NQ7qlip6rI3iBRUhceUVuCdwbuNjNVOTQ7oCtsNhri\nq6fuZG7rAgMBAAECggEAKKkLS3n+UNwV6L1Tu/yqRVpYR4O9SVlePkPf93zQB4q/\nDO6tc/nEG+OV/CCDESHLcAlUYSWdnDahpLmYBDHg4xWkrNI4VodsTpelZE++Nsny\nM18DQSzZAJvHe77+uFk6hCnG7bLmL+5utQ9HHRkKJYfaSY+wHmYOAv+Nbg1VC+3y\n6AglZ+x+PVJXYfW73X8JvZcvQC4sH4CpCOxxRzQ1mKb7XdDaR/xXWBuRTvm8JN6k\nTcQlgbLfPxxUPxLx8l8Di4P4/hFzjeL76TepoM3wy2fXFgyVXwHmkyuEnuOv2O8s\n2cNTBWR1No/fDe2c3sMEtBfH21zZKj6E7zY330HDgQKBgQDAVQ4rBqXAZmAcCmZN\nhBVzk/nwmv4dDrVD5JSA7A72FOd1XGObh2dvRuMCJFYYHm3HEtmkjWUOPZxkkHUW\ng8AYcFCddy/P/h+WamHKc2Agv6xDlZvwyhKGSB/FXgX4pZi7aoyFQXnvwaagdwkU\n1INAp2tHFlPGBnqZ9wVnbMqbDwKBgQC50RbsoZpZJTSeK8UO9hvAPq12xQz/ip8v\nXeFfuKpRyyX7SBnZXcurAOAUuitdYBvdQQA2B5o2rjObCq644Z2o1kvFvwuLjTjY\nPL6OWctk6yPuFxDjo1SsxjS+3ml1WAB68YWUFAkmyPbVQOfmWMncsiSsTIEfj+cT\nTEcYhR6eZQKBgFBceZICsgjk/a1ZrwsecDQdlSYyLJEJjzVx8Za4izvI2jkQRFI8\nzjwRe1JuykZDmIzAVI3Lwnijx4/BSBsDK6VKcHSK00BtptcbVgbYFEc6rwiCH2kJ\nlZnj0tqNgaM11c4hI9ud0wwZdry/X90DOmAuU8WdD53DIUDplKl1LGaDAoGBAKa/\nHn5M6tCSlaxXBOhPLEoRNOK/I9Hx2LXN3mBiu9zYm4Xqht/LzufuyidvhViu1XJw\nUTsrCVWGb+Ly7CYWuL95Rtf2f+rEWT2bDTl7FQ3EASM4abyNpn/BAjZCKorV5OBu\n+nsOm8PFVdO7Ah9wj/1Pk59WrAzhuvBTY/16ACcNAoGBAK0ttrdU+hHVbX9Z4aOH\nVi/ueNm/VMEK7gN+M2rgzXUzfOA2nmTMaN493PoDB/SH0nLRvBbzoJ3Mcdx0566L\nHA8pXJwNE7QsfzE//NEJC5QSptn4IGFVGouSA/oVy1vaPj/I/c7WKkF9/d40wNP7\nWVBi+qLJEN4BFAUm3/FyOCnp\n-----END PRIVATE KEY-----\n",
|
||||
"client_email": "yavsc-001@appspot.gserviceaccount.com",
|
||||
"client_id": "101611795594310312223",
|
||||
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||
"token_uri": "https://accounts.google.com/o/oauth2/token",
|
||||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||
"client_x509_cert_url": "https://www41.googleapis.com/robot/v1/metadata/x509/yavsc-001%40appspot.gserviceaccount.com"
|
||||
}
|
||||
},
|
||||
"Facebook": {
|
||||
"AppId": "552433071604577",
|
||||
"AppToken": "552433071604577|Ahk_Jkn3i-0jixWV2wEiNQDqIFs"
|
||||
},
|
||||
"Twilio": {
|
||||
"AccountSID": "AC2088e5494e711bc055bb9ca4dafb1ba7",
|
||||
"Token": "3ff6501aecc67a2ce826c30f7607cc0d",
|
||||
"SMSAccountFrom": "+33651141564"
|
||||
},
|
||||
"PayPal": {
|
||||
"Mode": "sandbox",
|
||||
"ClientId": "Ae9FgyE-R885ZSSiwtR_XlhaicGDqK5OEU912XOEQ5_LasTUtUtjT5zxAsb3tCl7croFnPtCAvYPeUAn",
|
||||
"ClientSecret": "EEYfxQNQp0rNdfTcCxmujtmvUEXASJ5FOK8F5acBB9_57hE67WwPheU0V4whE7Qgp1dd3p2IJYDExYXj",
|
||||
"Accounts": [{
|
||||
"ApiUsername": "paul_api1.pschneider.fr",
|
||||
"ApiPassword": "XE5TQ3VC5KB9B8AU",
|
||||
"Signature": "AFcWxV21C7fd0v3bYYYRCpSSRl31AnnEkKSPDeEm60yAsJkxHLEYDMUy"
|
||||
}],
|
||||
"ApplicationId": "APP-80W284485P519543T",
|
||||
"MerchantAccountId": "JL6JTE8C8SKLQ",
|
||||
"MerchantAccountUserName": "paul_api1.pschneider.fr"
|
||||
},
|
||||
"Societeinfo": {
|
||||
"ApiKey": "1b631h12vctbu25cqk2snlgbubebak6fd2f39t82jp7614a1asl"
|
||||
},
|
||||
"GitHub": {
|
||||
"ApiKey": "f248b78b21ee57f54a6cce7e7014f8ebf0620577"
|
||||
},
|
||||
"Twitter": {
|
||||
"ClientId": "fJAhbkzk9WZdTpCyjGHw1wBbx",
|
||||
"ClientSecret": "2tP84RWq6VkY4iwgQE9Rb75Nc5lmdX6XU2ppNMxF4h7ErBCbyg"
|
||||
}
|
||||
}
|
||||
}
|
||||
57
src/test/appsettings.json
Normal file
57
src/test/appsettings.json
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"Site": {
|
||||
"Authority": "dev.pschneider.fr",
|
||||
"Title": "Yavsc dev",
|
||||
"Slogan": "Yavsc : WIP.",
|
||||
"Banner": "/images/yavsc.png",
|
||||
"HomeViewName": "Home",
|
||||
"FavIcon": "/favicon.ico",
|
||||
"Icon": "/images/yavsc.png",
|
||||
"GitRepository": "testingrepo",
|
||||
"Owner": {
|
||||
"Name": "Site Owner Name",
|
||||
"EMail": "your@email",
|
||||
"PostalAddress": {
|
||||
"Street1": "Your Address",
|
||||
"Street2": "your street",
|
||||
"PostalCode": "543 21~3",
|
||||
"City": "",
|
||||
"State": "",
|
||||
"Province": null
|
||||
}
|
||||
},
|
||||
"Admin": {
|
||||
"Name": "Administrator name",
|
||||
"EMail": "daAdmin@e.mail"
|
||||
}
|
||||
},
|
||||
"Smtp": {
|
||||
"Host": "localhost",
|
||||
"Port": 25,
|
||||
"EnableSSL": false
|
||||
},
|
||||
"Logging": {
|
||||
"IncludeScopes": true,
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Warning",
|
||||
"Microsoft": "Warning"
|
||||
}
|
||||
},
|
||||
"Data": {
|
||||
"DevConnection": {
|
||||
"Database":"postgres",
|
||||
"Server": "[NpgsqlHostName]",
|
||||
"Port": 5432,
|
||||
"Username": "[devUserName]",
|
||||
"Password": "[DevPassword]"
|
||||
},
|
||||
"TestConnection": {
|
||||
"Database":"[TestDbName]",
|
||||
"Server": "[TestNpgsqlHostName]",
|
||||
"Port": 5432,
|
||||
"Username": "[TestUserName]",
|
||||
"Password": "[TestPassword]"
|
||||
}
|
||||
}
|
||||
}
|
||||
20
src/test/npm-debug.log
Normal file
20
src/test/npm-debug.log
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
0 info it worked if it ends with ok
|
||||
1 verbose cli [ 'C:\\Programs\\nodejs\\node.exe',
|
||||
1 verbose cli 'C:\\Programs\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
|
||||
1 verbose cli 'install' ]
|
||||
2 info using npm@1.4.9
|
||||
3 info using node@v8.11.3
|
||||
4 error install Couldn't read dependencies
|
||||
5 error package.json ENOENT: no such file or directory, open 'C:\Users\paul\Documents\GitHub\yavsc\test\package.json'
|
||||
5 error package.json This is most likely not a problem with npm itself.
|
||||
5 error package.json npm can't find a package.json file in your current directory.
|
||||
6 error System Windows_NT 6.1.7601
|
||||
7 error command "C:\\Programs\\nodejs\\node.exe" "C:\\Programs\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
|
||||
8 error cwd C:\Users\paul\Documents\GitHub\yavsc\test
|
||||
9 error node -v v8.11.3
|
||||
10 error npm -v 1.4.9
|
||||
11 error path C:\Users\paul\Documents\GitHub\yavsc\test\package.json
|
||||
12 error syscall open
|
||||
13 error code ENOPACKAGEJSON
|
||||
14 error errno -4058
|
||||
15 verbose exit [ -4058, true ]
|
||||
64
src/test/project.json
Normal file
64
src/test/project.json
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"version": "1.0.5-*",
|
||||
"title": "Yavsc - les tests",
|
||||
"description": "Yavsc xUnit testing",
|
||||
"authors": [
|
||||
"Paul Schneider <paul@pschneider.fr>"
|
||||
],
|
||||
"packOptions": {
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pazof/yavsc"
|
||||
},
|
||||
"licenseUrl": "https://github.com/pazof/yavsc/blob/vnext/LICENSE",
|
||||
"requireLicenseAcceptance": true,
|
||||
"owners": [
|
||||
"Paul Schneider <paul@pschneider.fr>"
|
||||
],
|
||||
"summary": "Yet another very small company",
|
||||
"projectUrl": "http://yavsc.pschneider.fr",
|
||||
"tags": [
|
||||
"Blog",
|
||||
"Blog",
|
||||
"PoS",
|
||||
"Chat"
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
"bin",
|
||||
"wwwroot",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"contrib",
|
||||
"testingrepo"
|
||||
],
|
||||
"tooling": {
|
||||
"defaultNamespace": "test"
|
||||
},
|
||||
"dependencies": {
|
||||
"EntityFramework.Commands": "7.0.0-rc1-final",
|
||||
"EntityFramework7.Npgsql": "3.1.0-rc1-3",
|
||||
"EntityFramework7.Npgsql.Design": "3.1.0-rc1-5",
|
||||
"Newtonsoft.Json": "9.0.1",
|
||||
"xunit": "2.1.0",
|
||||
"xunit.analyzers": "0.9.0",
|
||||
"xunit.assert": "2.1.0",
|
||||
"xunit.runner.console": "2.4.0-rc.2.build4045",
|
||||
"Microsoft.Dnx.TestHost": "1.0.0-rc1-final",
|
||||
"Microsoft.Dnx.Runtime": "1.0.0-rc1-final",
|
||||
"xunit.runner.dnx": "2.1.0-rc1-build204",
|
||||
"Yavsc.Server": {
|
||||
"target": "project"
|
||||
},
|
||||
"Yavsc": {
|
||||
"target": "project"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {}
|
||||
},
|
||||
"commands": {
|
||||
"test": "xunit.runner.dnx"
|
||||
},
|
||||
"userSecretsId": "aspnet5-YavscWeb-a0dadd21-2ced-43d3-96f9-7e504345102f"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue