コード例 #1
0
ファイル: MainWindowTest.cs プロジェクト: AKlaus/WPF
        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");
        }
コード例 #2
0
ファイル: ModuleController.cs プロジェクト: AKlaus/WPF
 /// <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();
 }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: AKlaus/WPF
 /// <summary>
 ///		C-tor to initialise the main view by Controller and ViewModel
 /// </summary>
 internal MainWindow(MainViewModel viewModel)
 {
     this.DataContext = viewModel;
     InitializeComponent();
 }