public void EditCommandTest_SelectedDevice( ) { SUTest viewModel = new SUTest( ); var mockContext = new MockContext <DeviceViewModel>( ); var mockLabContext = new MockContext <Laboratory>( ); var device = new DeviceViewModelMock(mockContext, mockLabContext); viewModel.SelectedDevice = device; Microsoft.VisualStudio.TestPlatform.UnitTestFramework.Assert.IsTrue(viewModel.EditCommand.CanExecute(null)); }
public void SelectedDeviceChangedTest_ToObject( ) { SUTest viewModel = new SUTest( ); bool canExecuteChanged = false; viewModel.EditCommand.CanExecuteChanged += (object sender, EventArgs e) => { canExecuteChanged = true; }; var mockContext = new MockContext <DeviceViewModel>( ); var mockLabContext = new MockContext <Laboratory>( ); var device = new DeviceViewModelMock(mockContext, mockLabContext); viewModel.SelectedDevice = device; Microsoft.VisualStudio.TestPlatform.UnitTestFramework.Assert.IsTrue(canExecuteChanged); }