示例#1
0
        public void CanNotExecuteRolledBack()
        {
            CommandTester tester = new CommandTester(() => true, () => { }, true);

            tester.Execute();
            tester.Rollback();

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

            Assert.IsTrue(exception.Message.Contains(tester.Name));
        }
示例#2
0
        public void Rollback(bool executeActionResult)
        {
            bool          executeAction  = false;
            bool          rollbackAction = false;
            CommandTester tester         = new CommandTester(() =>
            {
                {
                    executeAction = true;
                    return(executeActionResult);
                }
            }, () => { rollbackAction = true; }, true);


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