public void MainWindowViewModel_ShowEditCustomerViewCommandCanNotCall_WhenSelectedCustomerIsNull() { var viewModel = new MainWindowViewModel(_customerDataServiceMock.Object); viewModel.ViewModel = new CustomerGridViewModel(_customerDataServiceMock.Object); viewModel.SelectedCustomer = null; Assert.IsFalse(viewModel.ShowEditCustomerViewCommand.CanExecute(null)); }
public void MainWindowViewModel_ShowAddCustomerViewCommandSetViewModelToAddCustomerDetailsViewModel_WhenCallSuccessfuly() { var viewModel = new MainWindowViewModel(_customerDataServiceMock.Object); viewModel.ShowAddCustomerViewCommand.Execute(null); Assert.IsTrue(viewModel.ViewModel is AddCustomerDetailsViewModel); }
public void MainWindowViewModel_ShowEditCustomerViewCommandCanNotCall_WhenViewModelIsNotCustomerGridViewModel() { var viewModel = new MainWindowViewModel(_customerDataServiceMock.Object); viewModel.ViewModel = new AddCustomerDetailsViewModel(_customerDataServiceMock.Object, _regionDataServiceMock.Object); Assert.IsFalse(viewModel.ShowEditCustomerViewCommand.CanExecute(null)); }
public void MainWindowViewModel_ShowEditCustomerViewCommandSetViewModelToUpdateCustomerDetailsViewModel_WhenCallSuccessfuly() { var viewModel = new MainWindowViewModel(_customerDataServiceMock.Object); viewModel.ViewModel = new CustomerGridViewModel(_customerDataServiceMock.Object); viewModel.SelectedCustomer = new Customer(); viewModel.ShowEditCustomerViewCommand.Execute(null); Assert.IsTrue(viewModel.ViewModel is UpdateCustomerDetailsViewModel); }
public void MainWindowViewModel_DeleteCustomerCommandCallCustomerRepositoryDelete_WhenCallSuccessfuly() { var viewModel = new MainWindowViewModel(_customerDataServiceMock.Object); viewModel.ViewModel = new CustomerGridViewModel(_customerDataServiceMock.Object); viewModel.SelectedCustomer = new Customer(); viewModel.DeleteCustomerCommand.Execute(null); _customerDataServiceMock.Verify(repo => repo.DeleteCustomer(It.IsAny<Customer>()), Times.Once); }