public void Activatable_User_Control_View_Model_Is_Activated_And_Deactivated() { var root = new TestRoot(); var viewModel = new ActivatableViewModel(); var control = new ActivatableUserControl { ViewModel = viewModel }; Assert.False(viewModel.IsActivated); root.Child = control; Assert.True(viewModel.IsActivated); root.Child = null; Assert.False(viewModel.IsActivated); }
public void Activatable_Window_View_Model_Is_Activated_And_Deactivated() { using (UnitTestApplication.Start(TestServices.MockWindowingPlatform)) { var viewModel = new ActivatableViewModel(); var window = new ActivatableWindow { ViewModel = viewModel }; Assert.False(viewModel.IsActivated); window.Show(); Assert.True(viewModel.IsActivated); window.Close(); Assert.False(viewModel.IsActivated); } }