/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; ApplicationBootstrap.Initialize(); }
protected TestBase() { var runner = MongoDbRunner.Start(); ApplicationBootstrap.AddTestingServicesRegistrar(r => { r.RegisterServices(register => { register.Register <IDbContextProvider <EventStoreContext>, FakedEventStoreContextProvider>(); register .Register <IDbContextProvider <RestAirlineReadModelContext>, FakedEntityFramewokReadModelDbContextProvider>(); register.Register(f => { MongoUrl mongoUrl = new MongoUrl(runner.ConnectionString); IMongoDatabase mongoDatabase = new MongoClient(mongoUrl).GetDatabase("restairline-api-tests"); return(mongoDatabase); }, Lifetime.Singleton); }); }); var hostBuilder = new WebHostBuilder() .UseEnvironment("UnitTest") .ConfigureAppConfiguration((context, builder) => { builder.AddJsonFile("appsettings.UnitTest.json"); }) .UseStartup <Startup>(); _server = new TestServer(hostBuilder); HttpClient = _server.CreateClient(); CommandBus = ServiceProvider.GetService <ICommandBus>(); }
public static Container Create(WebBootstrapConfig config) { var container = ApplicationBootstrap.Create(config); container.RegisterMvcControllers(typeof(WebBootstrap).Assembly); return(container); }
public void Start( ApplicationBootstrap bootstrap, ComponentLocation componentLocation, ApplicationContext applicationContext, BackgroundTasks backgroundTasks) { Configure(componentLocation, bootstrap, applicationContext, backgroundTasks); bootstrap.Start(); }
protected TestBase() { ApplicationBootstrap.AddTestingServicesRegistrar(r => { r.RegisterServices(register => { register.Register <IDbContextProvider <EventStoreContext>, FakedEventStoreContextProvider>(); register.Register <IDbContextProvider <RestAirlineReadModelContext>, FakedEntityFramewokReadModelDbContextProvider>(); }); }); var hostBuilder = new WebHostBuilder() .UseEnvironment("UnitTest") .UseStartup <Startup>(); _server = new TestServer(hostBuilder); HttpClient = _server.CreateClient(); }
private static void Configure( ComponentLocation componentLocation, ApplicationBootstrap bootstrap, ApplicationContext applicationContext, BackgroundTasks backgroundTasks) { var operationsOutputViewModel = new OperationsOutputViewModel(); var operationPropertiesViewModel = new OperationPropertiesViewModel(); var scriptOperationsViewModel = new ScriptOperationsViewModel(operationPropertiesViewModel); var operationsViewModel = new OperationsViewModel(operationPropertiesViewModel); var operationViewsViewModel = new OperationViewsViewModel(new OperationsViewInitialization[] { operationsViewModel, scriptOperationsViewModel }); var componentInstancesViewModel = new ComponentInstancesViewModel(operationsViewModel, operationViewsViewModel); var operationMachinesByControlObject = new OperationMachinesByControlObject(); var outputFactory = new OutputFactory(operationsOutputViewModel); var testComponentViewModelFactory = new TestComponentViewModelFactory( componentInstancesViewModel, outputFactory, new WpfOperationViewModelFactory(applicationContext, scriptOperationsViewModel, new PropertySetBuilderFactory()), backgroundTasks, operationMachinesByControlObject, bootstrap); var componentsViewModel = new ComponentsViewModel(testComponentViewModelFactory); var topMenuBarViewModel = new TopMenuBarViewModel( componentInstancesViewModel, operationsOutputViewModel, new PersistentModelContentBuilderFactory(operationsOutputViewModel, operationMachinesByControlObject)); var factoryRepositories = componentLocation.LoadComponentRoots(); AddAllInstanceFactories(factoryRepositories, componentsViewModel); bootstrap.SetOperationPropertiesViewDataContext(operationPropertiesViewModel); bootstrap.SetTopMenuBarContext(topMenuBarViewModel); bootstrap.SetOperationsViewDataContext(operationsViewModel); bootstrap.SetScriptOperationsViewDataContext(scriptOperationsViewModel); bootstrap.SetOperationsOutputViewDataContext(operationsOutputViewModel); bootstrap.SetComponentsViewDataContext(componentsViewModel); bootstrap.SetComponentInstancesViewDataContext(componentInstancesViewModel); bootstrap.SetOperationsViewsViewDataContext(operationViewsViewModel); return; }