Example #1
0
        public void CanExecute_ShouldReturnValueFromInvokedMethod()
        {
            Action nullAction = null;
            var    command    = new Mvvm.Command(param => true, nullAction);

            Assert.True(command.CanExecute(null));
        }
Example #2
0
        public void Constructor2_WhenArgumentsAreValid_ShouldSetFields()
        {
            var result = new Mvvm.Command(canExecute1_valid, toExecute2_valid);

            Assert.Throws <ApplicationException>(() => result.CanExecute(null));
            Assert.Throws <ApplicationException>(() => result.Execute(null));
        }
Example #3
0
        public void CanExecute_ShouldUseArgumentInInvokedMethod()
        {
            object result     = null;
            int    testValue  = 2;
            Action nullAction = null;

            var command = new Mvvm.Command(param => { result = param; return(true); }, nullAction);

            command.CanExecute(testValue);

            Assert.Equal(testValue, result);
        }