refactoring
This commit is contained in:
26
test/BaseTestContext.cs
Normal file
26
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;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +1,13 @@
|
||||
using System;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.AspNet.Hosting.Internal;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Yavsc.Abstract.Manage;
|
||||
using Yavsc.Lib;
|
||||
using Yavsc.Services;
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
[Collection("EMaillingTeststCollection")]
|
||||
[Trait("regres", "no")]
|
||||
public class EMaillingTests : IClassFixture<ServerSideFixture>
|
||||
|
||||
{
|
@ -1,15 +1,13 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using Yavsc.Helpers;
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
[Trait("noregres", "yes")]
|
||||
public class YavscDnxUnitTests
|
||||
|
||||
[Trait("regres", "no")]
|
||||
public class NodeTests
|
||||
{
|
||||
[Fact]
|
||||
void TestNodeJsForAnsitohtml ()
|
@ -6,9 +6,11 @@ using Microsoft.Extensions.OptionsModel;
|
||||
using Yavsc.Lib;
|
||||
using Yavsc.Services;
|
||||
using Yavsc;
|
||||
using Xunit;
|
||||
|
||||
namespace test
|
||||
{
|
||||
[Trait("regres", "no")]
|
||||
public class ServerSideFixture : IDisposable {
|
||||
public SiteSettings _siteSetup;
|
||||
public ILogger _logger;
|
||||
@ -19,13 +21,13 @@ namespace test
|
||||
|
||||
public ServerSideFixture()
|
||||
{
|
||||
InitServices();
|
||||
InitTestHost();
|
||||
_logger = _loggerFactory.CreateLogger<ServerSideFixture> ();
|
||||
_logger.LogInformation("ServerSideFixture");
|
||||
}
|
||||
|
||||
|
||||
void InitServices()
|
||||
[Fact]
|
||||
void InitTestHost()
|
||||
{
|
||||
var host = new WebHostBuilder();
|
||||
|
@ -25,29 +25,17 @@ using System.Linq;
|
||||
|
||||
namespace test
|
||||
{
|
||||
public class BaseTestContext {
|
||||
protected IApplicationEnvironment applicationEnvironment = null;
|
||||
protected IServiceProvider serviceProvider = null;
|
||||
protected IConfigurationRoot configurationRoot;
|
||||
protected BeforeCompileContext beforeCompileContext;
|
||||
protected string testprojectAssetPath = "/home/paul/workspace/yavsc/Yavsc";
|
||||
|
||||
protected IServiceProvider provider;
|
||||
protected IConfigurationRoot configuration;
|
||||
}
|
||||
|
||||
[Collection("Yavsc mandatory success story")]
|
||||
[Trait("noregres", "yes")]
|
||||
[Trait("regres", "no")]
|
||||
public class YavscMandatory: BaseTestContext, IClassFixture<ServerSideFixture>
|
||||
{
|
||||
private readonly ITestOutputHelper _output;
|
||||
ServerSideFixture _serverFixture;
|
||||
public YavscMandatory(ITestOutputHelper output, ServerSideFixture serverFixture)
|
||||
|
||||
public YavscMandatory(ITestOutputHelper output, ServerSideFixture fixture) : base (output, fixture)
|
||||
{
|
||||
this._output = output;
|
||||
this._serverFixture = serverFixture;
|
||||
}
|
||||
|
||||
}
|
||||
[Fact]
|
||||
public void GitClone()
|
||||
{
|
@ -11,7 +11,6 @@ using Yavsc;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Services;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNet.Authentication;
|
||||
using Microsoft.Extensions.WebEncoders;
|
||||
using Yavsc.Lib;
|
||||
|
47
test/WIP/NotWorking.cs
Normal file
47
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));
|
||||
}
|
||||
}
|
||||
}
|
@ -14,19 +14,13 @@ using static OAuth.AspNet.AuthServer.Constants;
|
||||
namespace test
|
||||
{
|
||||
[Collection("Yavsc Work In Progress")]
|
||||
[Trait("noregres", "no")]
|
||||
[Trait("regres", "yes")]
|
||||
public class YavscWorkInProgress : BaseTestContext, IClassFixture<ServerSideFixture>
|
||||
{
|
||||
|
||||
ServerSideFixture _serverFixture;
|
||||
ITestOutputHelper output;
|
||||
public YavscWorkInProgress(ServerSideFixture serverFixture, ITestOutputHelper output)
|
||||
: base (output, serverFixture)
|
||||
{
|
||||
this.output = output;
|
||||
_serverFixture = serverFixture;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Theory]
|
||||
[InlineData("d9be5e97-c19d-42e4-b444-0e65863b19e1","blouh","profile",
|
@ -3,7 +3,6 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Hosting.Server;
|
||||
using Microsoft.AspNet.Http.Features;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Yavsc.Models;
|
||||
|
||||
namespace Yavsc.Server
|
||||
{
|
@ -1,54 +0,0 @@
|
||||
// // NotWorking.cs
|
||||
// /*
|
||||
// paul 21/06/2018 10:16 20182018 6 21
|
||||
// */
|
||||
using System;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using Xunit;
|
||||
using Microsoft.Dnx.Compilation.CSharp;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.AspNet.Builder.Internal;
|
||||
using Yavsc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace test
|
||||
{
|
||||
[Collection("Yavsc dropped intents")]
|
||||
public class NotWorking : BaseTestContext
|
||||
{
|
||||
|
||||
public void StringLocalizer()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
// IHostingEnvironment env = null;
|
||||
// IOptions<SiteSettings> siteSettings;
|
||||
|
||||
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);
|
||||
var rtd = app.Build();
|
||||
IOptions<LocalizationOptions> localOptions = Activator.CreateInstance<IOptions<LocalizationOptions>>(); ;
|
||||
// TODO build applicationEnvironment
|
||||
ResourceManagerStringLocalizerFactory strFact = new ResourceManagerStringLocalizerFactory
|
||||
(applicationEnvironment, localOptions);
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user