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);
        }
        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);
        }
        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);
        }
        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);
        }