Пример #1
0
        public void WhenStyleIsNotForWindowIsSet_InvalidOperationExceptionIsThrown()
        {
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();
            Style style = new Style(typeof(StackPanel));

            popupWindowAction.WindowStyle = style;

            INotification notification = new Notification();

            notification.Title   = "Title";
            notification.Content = "Content";

            Window window = popupWindowAction.GetWindow(notification);
        }
Пример #2
0
        public void WhenStartupLocationForWindowIsSet_ChildWindowHasProperty()
        {
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();

            popupWindowAction.WindowStartupLocation = WindowStartupLocation.CenterScreen;

            INotification notification = new Notification();

            notification.Title   = "Title";
            notification.Content = "Content";

            Window window = popupWindowAction.GetWindow(notification);

            Assert.Equal(WindowStartupLocation.CenterScreen, window.WindowStartupLocation);
        }
Пример #3
0
        public void WhenWindowContentImplementsIInteractionRequestAware_ShouldSetUpProperties()
        {
            MockInteractionRequestAwareElement element = new MockInteractionRequestAwareElement();
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();
            popupWindowAction.WindowContent = element;

            INotification notification = new Notification();
            notification.Title = "Title";
            notification.Content = "Content";

            Window window = popupWindowAction.GetWindow(notification);
            Assert.IsNotNull(element.Notification);
            Assert.ReferenceEquals(element.Notification, notification);
            Assert.IsNotNull(element.FinishInteraction);
        }
Пример #4
0
        public void WhenWindowContentIsSet_ShouldWrapContentInCommonWindow()
        {
            MockFrameworkElement element = new MockFrameworkElement();
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();
            popupWindowAction.WindowContent = element;

            INotification notification = new Notification();
            notification.Title = "Title";
            notification.Content = "Content";

            Window window = popupWindowAction.GetWindow(notification);
            Assert.IsNotInstanceOfType(window, typeof(DefaultNotificationWindow));
            Assert.IsNotInstanceOfType(window, typeof(DefaultConfirmationWindow));
            Assert.IsInstanceOfType(window, typeof(Window));
        }
Пример #5
0
        public void WhenStyleForWindowIsSet_WindowShouldHaveTheStyle()
        {
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();
            Style style = new Style(typeof(Window));

            popupWindowAction.WindowStyle = style;

            INotification notification = new Notification();

            notification.Title   = "Title";
            notification.Content = "Content";

            Window window = popupWindowAction.GetWindow(notification);

            Assert.Same(window.Style, style);
        }
Пример #6
0
        public void WhenWindowContentImplementsIInteractionRequestAware_ShouldSetUpProperties()
        {
            MockInteractionRequestAwareElement element           = new MockInteractionRequestAwareElement();
            TestablePopupWindowAction          popupWindowAction = new TestablePopupWindowAction();

            popupWindowAction.WindowContent = element;

            INotification notification = new Notification();

            notification.Title   = "Title";
            notification.Content = "Content";

            Window window = popupWindowAction.GetWindow(notification);

            Assert.NotNull(element.Notification);
            Assert.Same(element.Notification, notification);
            Assert.NotNull(element.FinishInteraction);
        }
Пример #7
0
        public void WhenWindowContentIsSet_ShouldWrapContentInCommonWindow()
        {
            MockFrameworkElement      element           = new MockFrameworkElement();
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();

            popupWindowAction.WindowContent = element;

            INotification notification = new Notification();

            notification.Title   = "Title";
            notification.Content = "Content";

            Window window = popupWindowAction.GetWindow(notification);

            Assert.IsNotType <DefaultNotificationWindow>(window);
            Assert.IsNotType <DefaultConfirmationWindow>(window);
            Assert.IsType <DefaultWindow>(window);
        }
Пример #8
0
        public void WhenWindowContentIsNotSet_ShouldUseDefaultWindowForConfirmations()
        {
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();
            popupWindowAction.IsModal = true;
            popupWindowAction.CenterOverAssociatedObject = true;

            INotification notification = new Confirmation();
            notification.Title = "Title";
            notification.Content = "Content";

            Assert.AreEqual(popupWindowAction.IsModal, true);
            Assert.AreEqual(popupWindowAction.CenterOverAssociatedObject, true);

            Window window = popupWindowAction.GetWindow(notification);
            Assert.IsInstanceOfType(window, typeof(DefaultConfirmationWindow));

            DefaultConfirmationWindow defaultWindow = window as DefaultConfirmationWindow;
            Assert.ReferenceEquals(defaultWindow.Confirmation, notification);
        }
Пример #9
0
        public void WhenDataContextOfWindowContentImplementsIInteractionRequestAware_ShouldSetUpProperties()
        {
            MockInteractionRequestAwareElement dataContext = new MockInteractionRequestAwareElement();
            MockFrameworkElement      element           = new MockFrameworkElement();
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();

            element.DataContext             = dataContext;
            popupWindowAction.WindowContent = element;

            INotification notification = new Notification();

            notification.Title   = "Title";
            notification.Content = "Content";

            Window window = popupWindowAction.GetWindow(notification);

            Assert.IsNotNull(dataContext.Notification);
            Assert.ReferenceEquals(dataContext.Notification, notification);
            Assert.IsNotNull(dataContext.FinishInteraction);
        }
Пример #10
0
        public void WhenWindowContentIsNotSet_ShouldUseDefaultWindowForConfirmations()
        {
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();

            popupWindowAction.IsModal = true;
            popupWindowAction.CenterOverAssociatedObject = true;

            INotification notification = new Confirmation();

            notification.Title   = "Title";
            notification.Content = "Content";

            Assert.True(popupWindowAction.IsModal);
            Assert.True(popupWindowAction.CenterOverAssociatedObject);

            Window window = popupWindowAction.GetWindow(notification);

            Assert.IsType <DefaultConfirmationWindow>(window);

            DefaultConfirmationWindow defaultWindow = window as DefaultConfirmationWindow;

            Assert.Same(defaultWindow.Confirmation, notification);
        }
Пример #11
0
        public void WhenWindowContentIsNotSet_ShouldUseDefaultWindowForConfirmations()
        {
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();

            popupWindowAction.IsModal = true;
            popupWindowAction.CenterOverAssociatedObject = true;

            INotification notification = new Confirmation();

            notification.Title   = "Title";
            notification.Content = "Content";

            Assert.AreEqual(popupWindowAction.IsModal, true);
            Assert.AreEqual(popupWindowAction.CenterOverAssociatedObject, true);

            Window window = popupWindowAction.GetWindow(notification);

            Assert.IsInstanceOfType(window, typeof(DefaultConfirmationWindow));

            DefaultConfirmationWindow defaultWindow = window as DefaultConfirmationWindow;

            Assert.ReferenceEquals(defaultWindow.Confirmation, notification);
        }
Пример #12
0
        public void WhenStartupLocationForWindowIsSet_ChildWindowHasProperty()
        {
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();
            popupWindowAction.WindowStartupLocation = WindowStartupLocation.CenterScreen;

            INotification notification = new Notification();
            notification.Title = "Title";
            notification.Content = "Content";

            Window window = popupWindowAction.GetWindow(notification);

            Assert.AreEqual(window.WindowStartupLocation, WindowStartupLocation.CenterScreen);
        }
Пример #13
0
        public void WhenStyleIsNotForWindowIsSet_InvalidOperationExceptionIsThrown()
        {
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();
            Style style = new Style(typeof(StackPanel));
            popupWindowAction.WindowStyle = style;

            INotification notification = new Notification();
            notification.Title = "Title";
            notification.Content = "Content";

            Window window = popupWindowAction.GetWindow(notification);
        }
Пример #14
0
        public void WhenStyleForWindowIsSet_WindowShouldHaveTheStyle()
        {
            TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction();
            Style style = new Style(typeof(Window));
            popupWindowAction.WindowStyle = style;

            INotification notification = new Notification();
            notification.Title = "Title";
            notification.Content = "Content";

            Window window = popupWindowAction.GetWindow(notification);

            Assert.AreSame(window.Style, style);
        }