本文整理汇总了C#中MainViewModel.ShowChildWindow方法的典型用法代码示例。如果您正苦于以下问题:C# MainViewModel.ShowChildWindow方法的具体用法?C# MainViewModel.ShowChildWindow怎么用?C# MainViewModel.ShowChildWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainViewModel
的用法示例。
在下文中一共展示了MainViewModel.ShowChildWindow方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WhenShowParentWindow_ItActivates
public void WhenShowParentWindow_ItActivates()
{
//Arrange
var eventAggregator = Mock.Create<IEventAggregator>(Behavior.Loose);
var mainVM = new MainViewModel { EventAggregator = eventAggregator };
var parentWindow = new BaseTopLevelWindow();
var childWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose);
Mock.Arrange(() => childWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>());
mainVM.Windows.Add(parentWindow);
mainVM.ShowChildWindow(parentWindow, childWindow);
// Act
mainVM.ShowParentWindow(parentWindow);
//Assert
Assert.AreEqual(parentWindow, mainVM.SelectedWindow);
}
示例2: WhenCreateNewItemFromChecklist_AnswerDetailsIsAlsoParentWindow
/// <summary>
/// Whens the create new item from checklist_ answer details is also parent window.
/// <author>Unknown</author>.
/// </summary>
/// [TestMethod]
public void WhenCreateNewItemFromChecklist_AnswerDetailsIsAlsoParentWindow()
{
var eventAggregator = Mock.Create<IEventAggregator>();
var mainVM = new MainViewModel { EventAggregator = eventAggregator };
var window1 = new BaseTopLevelWindow();
var window2 = Mock.Create<ITopLevelWindow>();
var window3 = Mock.Create<ITopLevelWindow>();
var childWindow = Mock.Create<ITopLevelWindow>();
Mock.Arrange(() => window3.ParentWindow).Returns(window2);
Mock.Arrange(() => childWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>());
mainVM.Windows.Add(window1);
mainVM.Windows.Add(window2);
mainVM.ShowChildWindow(window3, childWindow);
Assert.IsNotNull(mainVM.SelectedWindow);
Assert.IsTrue(childWindow.IsVisible);
Assert.IsTrue(childWindow.IsSelected);
Assert.AreEqual(childWindow.ParentWindow, window2);
}
示例3: WhenShowChildWindow_TitleCopiedToOriginalTitle
public void WhenShowChildWindow_TitleCopiedToOriginalTitle()
{
//Arrange
var eventAggregator = Mock.Create<IEventAggregator>(Behavior.Loose);
var mainVM = new MainViewModel { EventAggregator = eventAggregator };
var parentWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose);
var childWindow = new BaseTopLevelWindow();
mainVM.Windows.Add(parentWindow);
Mock.Arrange(() => parentWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>());
var title = Guid.NewGuid().ToString();
childWindow.Title = title;
// Act
mainVM.ShowChildWindow(parentWindow, childWindow);
//Assert
Assert.AreEqual(title, childWindow.OriginalTitle);
}
示例4: AfterShowGrandChildWindow_BreadCrumbsCountIncreases
public void AfterShowGrandChildWindow_BreadCrumbsCountIncreases()
{
// Arrange
var eventAggregator = Mock.Create<IEventAggregator>(Behavior.Loose);
var mainVM = new MainViewModel { EventAggregator = eventAggregator };
var parentWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose);
var childWindow = new BaseTopLevelWindow();
var grandChildWindow = new BaseTopLevelWindow();
mainVM.Windows.Add(parentWindow);
Mock.Arrange(() => parentWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>());
//Act
mainVM.ShowChildWindow(parentWindow, childWindow);
mainVM.ShowChildWindow(childWindow, grandChildWindow);
// Assert
Assert.AreEqual(grandChildWindow.Breadcrumbs.Count, 3);
}
示例5: AfterShowChildWindow_ParentWindowIsInvisible
public void AfterShowChildWindow_ParentWindowIsInvisible()
{
// Arrange
var eventAggregator = Mock.Create<IEventAggregator>(Behavior.Loose);
var mainVM = new MainViewModel { EventAggregator = eventAggregator };
var parentWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose);
var childWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose);
mainVM.Windows.Add(parentWindow);
Mock.Arrange(() => parentWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>());
Mock.Arrange(() => childWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>());
//Act
mainVM.ShowChildWindow(parentWindow, childWindow);
// Assert
Assert.IsFalse(parentWindow.IsVisible);
}
示例6: WhenPassWindowNotInWindowsCollection_ThrowsException
public void WhenPassWindowNotInWindowsCollection_ThrowsException()
{
var mainVM = new MainViewModel();
var parentWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose);
var childWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose);
mainVM.ShowChildWindow(parentWindow, childWindow);
}
示例7: WhenPassNullParentWindowToShowChildWindow_ThrowsException
public void WhenPassNullParentWindowToShowChildWindow_ThrowsException()
{
var mainVM = new MainViewModel();
var window1 = Mock.Create<ITopLevelWindow>(Behavior.Loose);
mainVM.ShowChildWindow(null, window1);
}