示例#1
0
        public void CanExecute_PredicateReturnsTrue_ReturnsTrue()
        {
            const bool expected = true;

            Action<object> execute = (arg) =>
                { };

            Predicate<object> canExecute = (arg) => true;

            var target = new RelayCommand(execute, canExecute);

            bool actual = target.CanExecute(null);

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void Execute_CanExecuteIsTrue_Succeeds()
        {
            const bool expected = true;
            bool actual;

            Action<object> execute = (arg) =>
            {
                actual = true;
            };

            Predicate<object> canExecute = (arg) => true;

            var target = new RelayCommand(execute, canExecute);

            actual = target.CanExecute(null);

            Assert.AreEqual(expected, actual);
        }