Example #1
0
        public void TestCanExecute_ShouldReturnTrue_IfCanExecuteFuncReturnTrue()
        {
            var command = new RelayCommand(delegate { }, p => true);

            bool canExecute = command.CanExecute(null);

            Assert.IsTrue(canExecute);
        }
Example #2
0
        public void TestExecute_ShouldExecuteAction()
        {
            bool execute = false;
            var command = new RelayCommand(delegate { execute = true; });

            command.Execute(null);

            Assert.IsTrue(execute);
        }
 public AllCustomersViewModel(ICustomerService service)
 {
     customers = new ObservableCollection<CustomerViewModel>();
     foreach (var customer in service.GetAllCustomers())
     {
         customers.Add(new CustomerViewModel(customer));
     }
     SelectCustomerCommand = new RelayCommand(OnCustomerSelected);
 }
Example #4
0
 public void TestConstructor_TakeActionParameter()
 {
     var command = new RelayCommand(delegate { });
     Assert.IsNotNull(command);
 }
Example #5
0
 public void TestConstructor_CanAssignFunctionForCanExecute()
 {
     var command = new RelayCommand(delegate { }, p => true);
     Assert.IsNotNull(command);
 }
 protected WorkspaceViewModel()
 {
     CloseCommand = new RelayCommand(p => OnRequestClose());
 }