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

            Assert.True(command.CanExecute(null));
        }
Exemplo n.º 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));
        }
Exemplo n.º 3
0
        public void Execute_ShouldUseArgumentInInvokedMethod()
        {
            object result    = null;
            int    testValue = 2;

            var command = new Mvvm.Command(() => true, param => result = param);

            command.Execute(testValue);

            Assert.Equal(testValue, result);
        }
Exemplo n.º 4
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);
        }