Ejemplo n.º 1
0
        public void Command_decorated_with_Transactional_attribute_mapped_to_method_should_be_executed_in_context_of_transaction()
        {
            bool executedInTransaction = false;
            var instance = new AggregateRootTarget("TitleSetInConstructor");
            var command = new TransactionalAggregateRootTargetUpdateTitleCommand { Title = "TransactionalAggregateRootTargetUpdateTitleCommand" };
            var executor = new TestAttributeMappedCommandExecutor<AggregateRootTarget>(command, instance);
            executor.VerificationAction = () => executedInTransaction = Transaction.Current != null;

            executor.Execute();

            Assert.True(executedInTransaction);
        }
Ejemplo n.º 2
0
        public void Command_decorated_with_Transactional_attribute_mapped_to_method_should_be_executed_in_context_of_transaction()
        {
            bool executedInTransaction = false;
            var  instance = new AggregateRootTarget("TitleSetInConstructor");
            var  command  = new TransactionalAggregateRootTargetUpdateTitleCommand {
                Title = "TransactionalAggregateRootTargetUpdateTitleCommand"
            };
            var executor = new TestAttributeMappedCommandExecutor <AggregateRootTarget>(command, instance);

            executor.VerificationAction = () => executedInTransaction = Transaction.Current != null;

            executor.Execute();

            Assert.IsTrue(executedInTransaction);
        }