public void load_should_resolve_relative_config_file() { // given string expectedTestDirPath = new DirectoryInfo("..\\..\\..\\..\\Example-TestFiles").FullName; string expectedSnippetsDirPath = new DirectoryInfo("..\\..\\..\\..\\Example-TestFiles\\ScriptSnippets").FullName; var store = new JsonConfigurationStore(_configLocatorMock.Object); // when IConfiguration config = store.Load(); // then Assert.That(config.TestFilesBaseDirectory, Is.EqualTo(expectedTestDirPath)); Assert.That(config.ScriptSnippetDirectory, Is.EqualTo(expectedSnippetsDirPath)); }
public void load_should_cache_configuration_for_next_call() { // given var store = new JsonConfigurationStore(_configLocatorMock.Object); IConfiguration config = store.Load(); string newConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "configuration-storetests.json"); CopyConfigFile(newConfigPath); ChangeConfigFile(newConfigPath); // when IConfiguration config2 = store.Load(); // then Assert.That(config, Is.EqualTo(config2)); }
public DefaultRegistry(IConfigurationStore configurationStore) { Scan( scan => { scan.TheCallingAssembly(); scan.Assembly("Syringe.Core"); scan.WithDefaultConventions(); }); For <System.Web.Http.Dependencies.IDependencyResolver>().Use <StructureMapResolver>(); For <Startup>().Use <Startup>().Singleton(); // Configuration: load the configuration from the store if (configurationStore == null) { configurationStore = new JsonConfigurationStore(new ConfigLocator()); } For <IConfigurationStore>().Use(configurationStore).Singleton(); IConfiguration configuration = configurationStore.Load(); For <IConfiguration>().Use(configuration); For <IEncryption>().Use(x => new AesEncryption(x.GetInstance <IConfiguration>().EncryptionKey)); For <IVariableEncryptor>().Use <VariableEncryptor>(); // ParallelTestFileQueue dependencies For <ITestFileRunnerLoggerFactory>().Use <TestFileRunnerLoggerFactory>().Singleton(); For <ITestFileResultRepositoryFactory>().Use(ctx => new TestFileResultRepositoryFactory(ctx)); For <ITestFileResultRepository>().Use <MongoTestFileResultRepository>().Singleton(); For <ITestFileQueue>().Use <ParallelTestFileQueue>().Singleton(); Forward <ITestFileQueue, ITaskObserver>(); For <IBatchManager>().Use <BatchManager>().Singleton(); For <IReservedVariableProvider>().Use(() => new ReservedVariableProvider("<environment here>")); SetupTestFileFormat(); SetupEnvironmentSource(configuration); For <ObjectCache>().Use(x => MemoryCache.Default); For <IJob>().Use <JobsManager>(); }