public async Task ExecuteAtTheEnd(ITestEnvironment testEnv) { if (DropDbAtTheEnd) { await db.Database.EnsureDeletedAsync(); } }
public static void Init() { te = IOC.Resolve <ITestEnvironment>(); testContext = IOC.Resolve <ITestContext>(); testCaseCode = null; theHarness = null; logger.Info("MutaGen Api - Init"); }
public TenantAutofacModule(Tenant tenant, IConfiguration applicationConfiguration, ITestEnvironment testEnvironment, IFeatureManager featureManager) { _tenant = tenant; _applicationConfiguration = applicationConfiguration; _testEnvironment = testEnvironment; _featureManager = featureManager; _autobookProviderApiAccessToken = applicationConfiguration["AutoBooks:AutobookProviderApiAccessToken"]; }
public State(ITestEnvironment[] environments, Func<ITestEnvironment, IDisposable> setUp) { foreach (ITestEnvironment environment in environments) { IDisposable innerState = setUp(environment); if (innerState != null) innerStates.Add(innerState); } }
public static async Task SampleTest(ITestEnvironment env) { await using var test = await env.CreateTest(); var functionality = test.Resolve <IGetUserById>(); var result = functionality.Execute(0); result.Should().NotBeNull(); result.Name.Should().Be("Tom"); }
private IEnumerable<ITestDescriptor> CreateTestGraph(ITestEnvironment environment) { var discovery = environment.DiscoveryService; if (discovery == null) throw new TestConfigurationException(string.Format("Test session environment {0} should provide discovery service", environment.GetType())); var testDescriptors = discovery.CreateTestGraph(); if (testDescriptors == null) throw new TestCompositionException(string.Format("Test session discovery {0} should return empty enumerable instead of null", discovery.GetType())); return testDescriptors; }
public static void InsertTestEntities <TEntity, TDbContext>(this ITestEnvironment testEnvironment, IEnumerable <TEntity> entites) where TEntity : class where TDbContext : DbContext { using (var serviceScope = testEnvironment.ServiceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { var dbContext = serviceScope.ServiceProvider.GetService <TDbContext>(); dbContext.Set <TEntity>().AddRange(entites); dbContext.SaveChanges(); } }
async Task <BlockExecutionResult> IBlock.Execute(ITestEnvironment testEnv) { if (RecreateDbAtStart) { await db.Database.EnsureDeletedAsync(); await db.Database.EnsureCreatedAsync(); } seedProvider.Add <TModel>(); await seedProvider.Seed(); return(BlockExecutionResult.EmptyContinue); }
Task <BlockExecutionResult> IBlock.Execute(ITestEnvironment testEnv) { var collection = new ServiceCollection(); foreach (var serviceDescriptor in internalCollection) { collection.Add(serviceDescriptor); } var provider = collection.BuildServiceProvider(); testEnv.SetServiceProvider(provider); return(Task.FromResult(BlockExecutionResult.EmptyContinue)); }
Task <BlockExecutionResult> IBlock.Execute(ITestEnvironment testEnv) { var sc = new ServiceCollection(); foreach (var serviceDescriptor in internalCollection) { sc.Add(serviceDescriptor); } Autofac.Populate(sc); var sp = new AutofacServiceProvider(Autofac.Build()); testEnv.SetServiceProvider(sp); return(Task.FromResult(BlockExecutionResult.EmptyContinue)); }
///// <summary> ///// Constructor. ///// </summary> public TenantDatabaseController(ITenantsRepository tenantsRepository, ITenantSettingsRepository tenantSettingsRepository, ITenantSettingsFeatureManager featureManager, IFeatureManager productFeatureManager, IFeatureSettingsProvider featureSettingsProvider, ITestEnvironment testEnvironment, IConfiguration configuration, IMapper mapper) { _tenantsRepository = tenantsRepository; _tenantSettingsRepository = tenantSettingsRepository; _featureManager = featureManager; _productFeatureManager = productFeatureManager; _featureSettingsProvider = featureSettingsProvider; _testEnvironment = testEnvironment; _configuration = configuration; _mapper = mapper; }
public static void SetupTenant( Tenant tenant, IConfiguration configuration, ITestEnvironment testEnvironment, IFeatureManager featureManager) { var rootFolder = System.Web.Hosting.HostingEnvironment.MapPath("/"); AppContainer.ConfigureTenant(tenant.Id, builder => { _ = builder.RegisterModule(new CoreAutofacModule(rootFolder)); _ = builder.RegisterModule(new LandmarkRunServicesModule(configuration, featureManager)); _ = builder.RegisterModule( new DefaultAuditEventModule(System.Web.Hosting.HostingEnvironment.MapPath("/Logs"))); _ = builder.RegisterModule(new TenantAutofacModule(tenant, configuration, testEnvironment, featureManager)); }); }
Task IBlock.ExecuteAtTheEnd(ITestEnvironment testEnv) { return(Task.CompletedTask); }
Task <BlockExecutionResult> IBlock.Execute(ITestEnvironment testEnv) { return(Task.FromResult(BlockExecutionResult.NewContinue(DateTime.Today))); }
public Task ExecuteAtTheEnd(ITestEnvironment testEnv) { return(Task.CompletedTask); }
public Task <BlockExecutionResult> Execute(ITestEnvironment testEnv) { return(Task.FromResult(BlockExecutionResult.EmptyContinue)); }
Task <BlockExecutionResult> IBlock.Execute(ITestEnvironment testEnv) { return(Task.FromResult(BlockExecutionResult.EmptyBreak)); }
public ResolveEnvironmentTest(IServiceProvider serviceProvider, TestOptions options, ITestEnvironment environment) : base(serviceProvider, options) { environment.Should().NotBeNull(); }
Task IBlock.ExecuteAtTheEnd(ITestEnvironment testEnv) { ((IServiceCollection)this).Clear(); return(Task.CompletedTask); }
public void SetTestEnvironment(ITestEnvironment environment) { _testEnvironment = environment; }
Task <BlockExecutionResult> IBlock.Execute(ITestEnvironment testEnv) { Logic(); return(Task.FromResult(BlockExecutionResult.EmptyContinue)); }
/// <summary> /// Creates a test environment manager. /// </summary> /// <param name="environments">The environments, not null.</param> public DefaultTestEnvironmentManager(ITestEnvironment[] environments) { this.environments = environments; }
public EnvironmentTestContext(ITestEnvironment environment) { myEnvironment = environment; }
public TestRun(ITestEnvironment environment, List <MethodInfo> tests) { Environment = environment; Tests = tests; }
public static ITestSession CreateSession(ITestEnvironment environment) { return new TestSession(new AnonymousConfiguration(() => environment)); }
public ElementEnvironment(XElement nsElement, ITestEnvironment env) { NamespaceElement = nsElement; Environment = env; }
public DocumentFactoryProvider(ITestEnvironment environment) { _environment = environment; }