public AppleAggregate(CreateApple command) : base(command.Id) { ApplyChange( new AppleCreated(command.Color, this, command)); }
public async Task HandleCreateAppleCommand() { var command = new CreateApple(Guid.NewGuid(), "Green", new CommandMeta(Guid.NewGuid(), Guid.NewGuid())); await _commandPublisher.SendAsync(command); Assert.True(AppleCommandHandlers.IsHandled); }
public async Task <IActionResult> Create([FromBody] CreateApple command) { var ip = HttpContext.Connection.RemoteIpAddress.ToString(); command.CommandMeta.UserIp = ip; await _commandSender.SendAsync(command); return(Ok()); }
public Apple(CreateApple command) : base(command.Id) { Id = Guid.NewGuid(); Color = command.Color; Weight = command.Weight; ApplyChange( new AppleCreated( Color, Weight, this, command) ); }
public async Task CreateAggregate() { var id = Guid.NewGuid(); var color = "Green"; var createApple = new CreateApple(id, color, new CommandMeta(Guid.NewGuid(), Guid.NewGuid())); var aggregate = new AppleAggregate(createApple); var events = aggregate.GetUncommittedEvents(); await _eventStore.AppendAsync(events); Assert.Equal(id, aggregate.Id); Assert.Equal(aggregate.Color, color); Assert.Single(events); }
void Start() { appleAmount = appleAmount.GetComponent <CreateApple> (); }