public void TestAboutCommand() { bool flag = false; var mock = new Mock<IModuleController>(); mock.Setup(ctrl => ctrl.ShowAbout()).Callback(() => flag = true); var viewModel = new MainViewModel(mock.Object); viewModel.AboutCommand.Execute(null); Assert.AreEqual(true, flag, "The AboutCommand doesn't create an instance of the About window"); }
/// <summary> /// Show the main window of the application. /// This method must be executed only once in App.xaml.cs /// </summary> internal void ShowMainWindow() { // No need to create and show the main window once it's been created. // It's meant to be always on the screen if (mainWindow != null) return; // Create ViewModel of the main form and hook up with the View var viewModel = new MainViewModel(this); mainWindow = new MainWindow(viewModel); mainWindow.Show(); }
/// <summary> /// C-tor to initialise the main view by Controller and ViewModel /// </summary> internal MainWindow(MainViewModel viewModel) { this.DataContext = viewModel; InitializeComponent(); }