public static IEnumerable <Type> GetRegisteredServices <TForType>(this IMiruApp app) { return(app.Get <IServiceCollection>() .Where(_ => _.ServiceType == typeof(TForType)) .Select(_ => _.ImplementationType) .ToImmutableList()); }
public static string ConfigYml(this IMiruApp app, MiruSolution solution = null) { // solution = solution ?? app.Get<Solution>(); // return solution.GetConfigYml(app.Config.Environment); return(string.Empty); }
public ConfigShowConsolable( IHostEnvironment hostEnvironment, IConfiguration configuration, IMiruApp app) { _hostEnvironment = hostEnvironment; _configuration = configuration; _app = app; }
public static IWebHostBuilder UseMiru(this IWebHostBuilder builder, IMiruApp app) { // var solution = app.Get<Solution>(); // // builder.UseContentRoot(solution.AppDir); // // builder.ConfigureServices(services => // { // var container = app.Get<IServiceProvider>(); // services.AddSingleton(container); // }); return(builder); }
public static TResult SendSync <TResult>(this IMiruApp app, IRequest <TResult> message) { using var scope = app.WithScope(); var mediator = scope.Get <IMediator>(); try { return(mediator.Send(message).Result); } catch (AggregateException e) { throw e.InnerException ?? e; } }
public IMiruApp Start(ITestConfig config, Action <IServiceCollection> servicesSetup = null) { _testRunConfig = new TestRunConfig(); var servicesFromTestConfig = new ServiceCollection(); config.ConfigureRun(_testRunConfig); config.ConfigureTestServices(servicesFromTestConfig); var builder = config.GetHostBuilder(); builder.UseEnvironment("Test"); builder.ConfigureServices(services => { services.AddSingleton(this); services.AddSingleton <TestFixture, TestFixture>(); services.AddSingleton <ISessionStore, MemorySessionStore>(); services.AddSingleton <IUserSession, TestingUserSession>(); services.AddSingleton <Faker, Faker>(); // services.ReplaceSingleton<ILogger>(sp => TestLoggerConfigurations.ForTests(sp.GetService<Storage>())); services.AddRange(servicesFromTestConfig); // test engine stuff services.AddSingleton <TestConfigRunner>(); services.AddSingleton(_testRunConfig); servicesSetup?.Invoke(services); }); var host = builder.Build(); var sp = host.Services; App = sp.GetService <IMiruApp>(); ExecuteBeforeSuite(); return(App); }
public static async Task <TResult> SendAsync <TResult>(this IMiruApp app, IRequest <TResult> message) { using (var scope = app.WithScope()) { var mediator = scope.Get <IMediator>(); try { return(await mediator.Send(message)); } catch (AggregateException e) { throw e.InnerException ?? e; } } }
public PageTestFixture( IMiruApp app, UrlLookup urlLookup, PageTestingConfig config, RemoteWebDriver driver, IStorage storage, PageBody browser, MiruNavigator navigator) : base(navigator) { App = app; _urlLookup = urlLookup; _config = config; _driver = driver; _storage = storage; _browser = browser; _browser.BaseUrl = _config.BaseUrl; navigator.ConfigureExceptions(context => { var exceptionMessage = $@"{context.FailureMessage.Or(context.OriginalException.Message)} The url was: {Url} A screenshot was taken on the moment of the failure: {FailureScreenshot()} The Page's html has been saved to: {SaveHtml()} "; throw new PageTestException(exceptionMessage, context.OriginalException); }); }
public ScopedServices(IMiruApp app) { _scope = app.Get <IServiceProvider>().CreateScope(); _services = _scope.ServiceProvider; }
public static IWebHost BuildForMiru(this IWebHostBuilder builder, IMiruApp app) { return(builder.UseMiru(app).Build()); }
public QueueRunConsolable(IMiruApp app) { _app = app; }
public ValidatorFactory(IMiruApp app) { _app = app; }
public CliMiruHost(IMiruApp app, MiruCommandCreator commandCreator, ArgsConfiguration argsConfig) { _app = app; _commandCreator = commandCreator; _argsConfig = argsConfig; }
public CliMiruHost(IMiruApp app, ArgsConfiguration argsConfig) { _app = app; _argsConfig = argsConfig; }
public ConsolableHandler(IMiruApp app) { _app = app; }
public CliMiruHost(IEnumerable <Consolable> commands, ArgsConfiguration argsConfig, IMiruApp app) { _consolable = commands; _argsConfig = argsConfig; _app = app; }
public static void WithScope(this IMiruApp app, Action <ScopedServices> action) { using var scope = app.Get <ScopedServices>(); action(scope); }
public TestFixture(IMiruApp app) { App = app; }
public MiruCommandCreator(IMiruApp app) { _app = app; }
public MiruDbContext(IMiruApp app) : base(app.Get <DbContextOptions>()) { QueryFilterManager.InitilizeGlobalFilter(this); }
public static ScopedServices WithScope(this IMiruApp app) { return(app.Get <ScopedServices>()); }
public TestingUserSession(IMiruApp app, ICurrentUser currentUser) { _app = app; _currentUser = currentUser; }
public static TReturn WithScope <TReturn>(this IMiruApp app, Func <ScopedServices, TReturn> func) { using var scope = app.Get <ScopedServices>(); return(func(scope)); }
public FooDbContext(IMiruApp app) : base(app) { }