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