Exemple #1
0
        public void JustSetFrameContent2()
        {
            var runTestMonitor      = new ManualResetEventSlim(false);
            var assertionsMonitor   = new ManualResetEventSlim(false);
            var windowClosedMonitor = new ManualResetEventSlim(false);

            var(thread, mainWindow) = WindowDispatch.CreateWindowOnSTAThread(() => new MainWindow(), w => { });

            WindowDispatch.DispatchOn(mainWindow, () =>
            {
                var page1 = new Page1();
                mainWindow.NavigationHost.Source = new Uri("/wpf-tdd;component/WpfApp/Pages/Page1.xaml", UriKind.RelativeOrAbsolute);
            }, runTestMonitor, TimeSpan.FromSeconds(1));

            WindowDispatch.DispatchOn(mainWindow, () => Assert.NotNull(mainWindow.NavigationHost.Content),
                                      assertionsMonitor, TimeSpan.FromSeconds(1));
            WindowDispatch.DispatchOn(mainWindow, () => mainWindow.Close(), windowClosedMonitor,
                                      TimeSpan.FromSeconds(1));
        }
Exemple #2
0
        public void JustSetFrameContent2()
        {
            var runTestMonitor      = new ManualResetEventSlim(false);
            var assertionsMonitor   = new ManualResetEventSlim(false);
            var windowClosedMonitor = new ManualResetEventSlim(false);

            var(thread, mainWindow) = WindowDispatch.CreateWindowOnSTAThread(() => new MainWindow(), w => { });

            WindowDispatch.DispatchOn(mainWindow, () =>
            {
                var page1 = new Page1();
                mainWindow.NavigationHost.Content = page1;
            }, runTestMonitor, TimeSpan.FromSeconds(1));

            WindowDispatch.DispatchOn(mainWindow, () => Assert.NotNull(mainWindow.NavigationHost.Content),
                                      assertionsMonitor, TimeSpan.FromSeconds(1));
            WindowDispatch.DispatchOn(mainWindow, () => mainWindow.Close(), windowClosedMonitor,
                                      TimeSpan.FromSeconds(1));
        }