public static void TestCanExecute()
        {
            int result = 0;
            DelegateAction <int> action = new DelegateAction <int>((i) => result = i + i, (i) => i == result);

            Assert.That(action.CanExecute(0), Is.True);
            Assert.That(action.CanExecute(1), Is.False);
        }
        public static void TestExecuteWithNoConditionForCanExecute()
        {
            int result = 0;
            DelegateAction <int> action = new DelegateAction <int>((i) => result = i + i);

            Assert.That(action.CanExecute(0), Is.True);
            Assert.That(action.CanExecute(1), Is.True);

            result = 5;
            action.Execute(5);

            Assert.That(result, Is.EqualTo(10));
        }
        public static void TestExecuteWhenNotCanExecute()
        {
            int result = 0;
            DelegateAction <int> action = new DelegateAction <int>((i) => result = i + i, (i) => i == result);

            Assert.That(action.CanExecute(0), Is.True);
            Assert.Throws <InvalidOperationException>(() => action.Execute(5));
        }