예제 #1
0
        public void ExecuteWithCanExecute()
        {
            var executed = false;
            var cmd      = new DarkCommand(() => executed = true, () => true);

            cmd.Execute(null);
            Assert.True(executed);
        }
예제 #2
0
        public void ExecuteRunsIfReferenceTypeAndSetToNull()
        {
            var executions = 0;
            var command    = new DarkCommand <FakeChildContext>(context => executions += 1);

            command.Execute(null);
            Assert.True(executions == 1, "the command should have executed");
        }
예제 #3
0
        public void ExecuteRunsIfNullableAndSetToNull()
        {
            var executions = 0;
            var command    = new DarkCommand <int?>(context => executions += 1);

            command.Execute(null);
            Assert.True(executions == 1, "the command should have executed");
        }
예제 #4
0
        public void GenericExecuteWithCanExecute()
        {
            string result = null;
            var    cmd    = new DarkCommand <string>(s => result = s, s => true);

            cmd.Execute("Foo");
            Assert.Equal("Foo", result);
        }
예제 #5
0
        public void ExecuteParameterized()
        {
            object executed = null;
            var    cmd      = new DarkCommand(o => executed = o);

            var expected = new object();

            cmd.Execute(expected);

            Assert.Equal(expected, executed);
        }