Ejemplo n.º 1
0
        public void TestCanExecute_ShouldReturnTrue_IfCanExecuteFuncReturnTrue()
        {
            var command = new RelayCommand(delegate { }, p => true);

            bool canExecute = command.CanExecute(null);

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

            command.Execute(null);

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