public void Init() { IAppModule appModule = new TAppModule(); AppSetup setup = new AppSetup(); this.App = setup.Start(appModule); IComponentContainer componentContainer = this.App.GetAppContainer <IComponentContainer>(); ComponentContainer = componentContainer.BeginScope("TEST"); }
public void Init() { Console.WriteLine("CommandBusTests.Init"); IAppModule appModule = new TestAppModule(); AppSetup setup = new AppSetup(); var app = setup.Start(appModule); IComponentContainer componentContainer = app.GetAppContainer <IComponentContainer>(); ComponentContainer = componentContainer.BeginScope("TEST"); }
public void RemoveService() { IAppModule appModule = new TestAppModule(); AppSetup setup = new AppSetup(); var app = setup.Start(appModule); IComponentContainer componentContainer = app.GetAppContainer <IComponentContainer>(); using (var scope = componentContainer.BeginScope("TEST")) { ICL1Service service = scope.CreateComponent <ICL1Service>(); Assert.AreEqual("TEST", service.GetName()); } }
public void GetServiceThatRegistedByTestAppModule() { IAppModule appModule = new TestAppModule(); AppSetup setup = new AppSetup(); var app = setup.Start(appModule); IComponentContainer componentContainer = app.GetAppContainer <IComponentContainer>(); using (var scope = componentContainer.BeginScope("test")) { ServiceRegistedByAppModule service = scope.CreateComponent <ServiceRegistedByAppModule>(); Assert.IsNotNull(service); Assert.IsInstanceOfType(service, typeof(DefaultServiceRegistedByAppModule)); } }
public void TestConfigWithFileNotExists() { IAppModule appModule = new TestAppModule(); AppSetup setup = new AppSetup("./abc.json"); var app = setup.Start(appModule); IComponentContainer componentContainer = app.GetAppContainer <IComponentContainer>(); using (var scope = componentContainer.BeginScope("test")) { TestConfig config1 = scope.CreateComponent <TestConfig>(); TestConfig config2 = scope.CreateComponent <TestConfig>(); Assert.AreEqual("Mode", config1.Mode); Assert.AreEqual(config1, config2); } }
public override void OnAppStarted(App app) { IComponentContainer componentContainer = app.GetAppContainer <IComponentContainer>(); using (var scope = componentContainer.BeginScope("GenerateJsonSchema")) { AppConfig appConfig = scope.CreateComponent <AppConfig>(); if (!appConfig.GenerateConfigJsonSchema) { return; } IJsonSchemaGenerator generator = scope.CreateComponent <IJsonSchemaGenerator>(); string json = generator.Generate(this.registions); string path = this.configFilePath.Replace(".json", ".schema.json"); File.WriteAllText(path, json); } }