public void UpdateCustomerDetailsViewModel_SaveCustomerCommandCanNotExecute_WhenRatingIsNotNumeric()
        {
            var viewModel = new UpdateCustomerDetailsViewModel(_customerDataService.Object, _regionDataService.Object, _customer);
            var customerModel = new CustomerModel() { FirstName = "Test", LastName = "Test", Email = "Test", Rating = "Test", RegionId = 1 };

            Assert.IsFalse(viewModel.SaveCustomerCommand.CanExecute(customerModel));
        }
        public void UpdateCustomerDetailsViewModel_NotifyClosingEventHandlerIsRaise_WhenCloseCurrentView()
        {
            var viewModel = new UpdateCustomerDetailsViewModel(_customerDataService.Object, _regionDataService.Object, _customer);

            bool raise = false;

            viewModel.NotifyClosingEventHandler += (sender, e) =>
            {
                raise = true;
            };
            viewModel.CloseCurrentViewCommand.Execute(null);

            Assert.IsTrue(raise);
        }
Ejemplo n.º 3
0
 private void ShowEditCustomerView()
 {
     ViewModel = new UpdateCustomerDetailsViewModel(SelectedCustomer);
     (ViewModel as UpdateCustomerDetailsViewModel).NotifyClosingEventHandler += ShowCustomerGridView;
 }
        public void UpdateCustomerDetailsViewModel_SaveCustomerCommandCallsCustomerDataServiceUpdateCustomer_WhenSuccessfully()
        {
            var viewModel = new UpdateCustomerDetailsViewModel(_customerDataService.Object, _regionDataService.Object, _customer);
            var customerModel = new CustomerModel() { FirstName = "Test", LastName = "Test", Email = "Test", Rating = "5", RegionId = 1 };

            viewModel.SaveCustomerCommand.Execute(customerModel);

            _customerDataService.Verify(repo => repo.UpdateCustomer(It.IsAny<Customer>()), Times.Once);
        }