public void ExecuteCallsOfTPassedInExecuteDelegate()
        {
            var handlers  = new DelegateObjectHandlers();
            var command   = new ActivatableCanExecuteObserverCommand <object>(handlers.Execute, new CommandManagerObserver());
            var parameter = new object();

            command.Execute(parameter);

            Assert.AreSame(parameter, handlers.ExecuteParameter);
        }
        public void ExecuteCallsCanExecuteFalse()
        {
            var handlers = new DelegateObjectHandlers();
            var command  =
                new ActivatableCanExecuteObserverCommand <object>(handlers.Execute, o => false, new CommandManagerObserver()) as ICommand;
            var parameter = new object();

            command.Execute(parameter);

            Assert.AreSame(null, handlers.ExecuteParameter);
        }
Esempio n. 3
0
        public void ShouldPassParameterInstanceOnExecute()
        {
            var      executeCalled = false;
            var      testClass     = new MyClass();
            ICommand command       = new ActivatableCanExecuteObserverCommand <MyClass>(
                delegate(MyClass parameter)
            {
                Assert.AreSame(testClass, parameter);
                executeCalled = true;
            },
                new DummyObserver());

            command.Execute(testClass);
            Assert.True(executeCalled);
        }
Esempio n. 4
0
        public void WhenConstructedWithGenericTypeIsNonNullableValueType_Throws()
        {
            var command = new ActivatableCanExecuteObserverCommand <int>(param => { }, new DummyObserver());

            command.Execute(1);
        }