public void Command_should_create_and_then_use_existing() { var command = new AggregateRootTargetCreateOrUpdateTitleCommand { Title = "AggregateRootCreateNewCommand", Id = Guid.NewGuid() }; TheService.Execute(command); AggRoot.Title.Should().Be("AggregateRootCreateNewCommand"); var arId = AggRoot.ArId; command = new AggregateRootTargetCreateOrUpdateTitleCommand { Title = "AggregateRootCreateNewCommand2", Id = Guid.NewGuid() }; TheService.Execute(command); AggRoot.Title.Should().Be("AggregateRootCreateNewCommand2"); Assert.NotEqual(arId, AggRoot.ArId); var createTicks = AggRoot.created; arId = AggRoot.ArId; command = new AggregateRootTargetCreateOrUpdateTitleCommand { Title = "AggregateRootUpdatedCommand", Id = arId }; TheService.Execute(command); AggRoot.Title.Should().Be("AggregateRootUpdatedCommand"); AggRoot.ArId.Should().Be(arId); AggRoot.created.Should().Be(createTicks); }
public void Command_should_create_and_update_the_title_of_the_aggregate_root() { AggregateRootTarget instance = null; var command = new AggregateRootTargetCreateOrUpdateTitleCommand { Title = "AggregateRootTargetUpdateTitleCommand" }; var executor = new TestAttributeMappedCommandExecutor<AggregateRootTarget>(command, instance); executor.Execute(); executor.Instance.Title.Should().Be("AggregateRootTargetUpdateTitleCommand"); }
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_should_create_and_then_use_existing() { var command = new AggregateRootTargetCreateOrUpdateTitleCommand { Title = "AggregateRootCreateNewCommand", Id = Guid.NewGuid() }; TheService.Execute(command); AggRoot.Title.Should().Be("AggregateRootCreateNewCommand"); var arId = AggRoot.ArId; command = new AggregateRootTargetCreateOrUpdateTitleCommand { Title = "AggregateRootCreateNewCommand2", Id = Guid.NewGuid() }; TheService.Execute(command); AggRoot.Title.Should().Be("AggregateRootCreateNewCommand2"); Assert.NotEqual(arId, AggRoot.ArId); var createTicks = AggRoot.created; arId = AggRoot.ArId; command = new AggregateRootTargetCreateOrUpdateTitleCommand { Title = "AggregateRootUpdatedCommand", Id = arId }; TheService.Execute(command); AggRoot.Title.Should().Be("AggregateRootUpdatedCommand"); AggRoot.ArId.Should().Be(arId); AggRoot.created.Should().Be(createTicks); }