public void Command_should_create_new_aggregate_root() { var command = new AggregateRootTargetCreateNewCommand { Title = "AggregateRootTargetCreateNewCommand" }; var executor = new TestAttributeMappedCommandExecutor <AggregateRootTarget>(command); executor.Execute(); executor.Instance.Title.Should().Be("AggregateRootTargetCreateNewCommand"); }
public void Command_should_create_new_complex_aggregate_root_using_implicit_parameter_mappings() { var command = new ComplexAggregateRootTargetCreateNewCommand4 { Title = "ComplexAggregateRootTargetCreateNewCommand4", Quantity = 40 }; var executor = new TestAttributeMappedCommandExecutor <ComplexAggregateRootTarget>(command); executor.Execute(); executor.Instance.Title.Should().Be("ComplexAggregateRootTargetCreateNewCommand4"); executor.Instance.Quantity.Should().Be(40); }
public void Command_should_update_the_title_of_the_existing_aggregate_root() { var instance = new AggregateRootTarget("TitleSetInConstructor"); var command = new AggregateRootTargetCreateOrUpdateTitleCommand { Title = "AggregateRootTargetUpdateTitleCommand" }; var executor = new TestAttributeMappedCommandExecutor <AggregateRootTarget>(command, instance); executor.Execute(); executor.Instance.Title.Should().Be("AggregateRootTargetUpdateTitleCommand"); }
public void Command_decorated_with_Transactional_attribute_mapped_to_constructor_should_be_executed_in_context_of_transaction() { bool executedInTransaction = false; var command = new TransactionalAggregateRootTargetCreateNewCommand { Title = "TransactionalAggregateRootTargetCreateNewCommand" }; var executor = new TestAttributeMappedCommandExecutor <AggregateRootTarget>(command); executor.VerificationAction = () => executedInTransaction = Transaction.Current != null; executor.Execute(); Assert.IsTrue(executedInTransaction); }
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); }