Пример #1
0
        public void CanNotExecuteTwice()
        {
            CommandTester tester = new CommandTester(() => true, () => { }, true);

            tester.Execute();

            InvalidOperationException exception = Assert.Throws <InvalidOperationException>(() => tester.Execute());

            Assert.IsTrue(exception.Message.Contains(tester.Name));
        }
Пример #2
0
        public void Execute(bool executeActionResult)
        {
            bool          executeAction  = false;
            bool          rollbackAction = false;
            CommandTester tester         = new CommandTester(() =>
            {
                {
                    executeAction = true;
                    return(executeActionResult);
                }
            }, () => { rollbackAction = true; }, true);


            Assert.AreEqual(executeActionResult, tester.Execute());
            Assert.IsTrue(executeAction);
            Assert.IsFalse(rollbackAction);
        }