protected override void OnStartup(StartupEventArgs e)
        {
            try
            {
                base.OnStartup(e);

                var filters = ConfigurationManager.AppSettings["MonitoredFiles"];

                _compositionRoot = new CompositionRoot(
                    new WindowsFileSystemWatcherFactory(),
                    new WindowsSystemServices(),
                    filters);

                var lazyMainWindow = new LazyMainWindow();

                var useCases = _compositionRoot.Compose(
                    lazyMainWindow, new WindowsDiagnosticMessages(lazyMainWindow, lazyMainWindow));

                lazyMainWindow.ForwardAllInvocationsTo(new MainWindow(useCases));

                useCases.Initialize();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message + " The application will exit now.");
                Shutdown(-1);
            }
        }
예제 #2
0
        private static void ShouldBePassedToRegisteredInnerInstance(Action <GuiMainWindow> invocation)
        {
            //GIVEN
            var window        = new LazyMainWindow();
            var innerInstance = Substitute.For <GuiMainWindow>();

            window.ForwardAllInvocationsTo(innerInstance);

            //WHEN
            invocation(window);

            //THEN
            invocation(innerInstance.Received(1));
        }