Ejemplo n.º 1
0
        public void ShowAndCloseDialogView()
        {
            var owner          = new object();
            var mockDialogView = new TestMockDialogView();

            // Call ShowDialog without the ShowDialogAction
            mockDialogView.ShowDialog(owner);

            var showDialogCalled = false;

            TestMockDialogView.ShowDialogAction = view =>
            {
                Assert.AreEqual(owner, view.Owner);
                Assert.IsTrue(view.IsVisible);
                view.Close();
                showDialogCalled = true;
            };

            Assert.IsFalse(mockDialogView.IsVisible);
            mockDialogView.ShowDialog(owner);
            Assert.IsTrue(showDialogCalled);
            Assert.IsFalse(mockDialogView.IsVisible);
        }
Ejemplo n.º 2
0
        public void AutomaticCleanupTestWithoutMef()
        {
            TestMockDialogView shownView = null;

            TestMockDialogView.ShowDialogAction = view =>
            {
                shownView = view;
            };

            var dialogView = new TestMockDialogView();

            Assert.IsNull(shownView);
            dialogView.ShowDialog(null);
            Assert.AreEqual(dialogView, shownView);

            Assert.IsNotNull(TestMockDialogView.ShowDialogAction);
            TestMockDialogView.ShowDialogAction = null;
        }