private bool Execute(SetLocationCommand command) { var aggregateEvent = new LocationSetEvent(command.Location); Emit(aggregateEvent); return(true); }
public void AddPackage() { CurrentFeeder = new Feeder(); _isEditing = false; AddFeederCommand.RaiseCanExecuteChanged(); SaveFeederCommand.RaiseCanExecuteChanged(); DeleteFeederCommand.RaiseCanExecuteChanged(); CancelFeederCommand.RaiseCanExecuteChanged(); SetLocationCommand.RaiseCanExecuteChanged(); }
public async Task <IActionResult> SetLocation([FromRoute] string id, [FromBody] SetLocationCommand command) { command.Id = id; var result = await _mediator.Send(command); if (result) { return(Ok()); } return(BadRequest()); }
public void SaveFeeder() { if (!_isEditing) { FeederDefintions.Add(CurrentFeeder); } _isDirty = true; CurrentFeeder = null; AddFeederCommand.RaiseCanExecuteChanged(); SaveLibraryCommand.RaiseCanExecuteChanged(); SetLocationCommand.RaiseCanExecuteChanged(); }
public void RecoveredState_AfterSetLocationCommand_LocationSetEventEmitted_UsingAsk() { var probe = CreateTestActor("probeActor"); Sys.EventStream.Subscribe(probe, typeof(DomainEvent <Device, DeviceId, LocationSetEvent>)); var aggregateManager = Sys.ActorOf(Props.Create(() => new DeviceManager()), "test-devicemanager"); var aggregateId = TestAggregateId; var cmd = new SetLocationCommand(aggregateId, "Ask Updated Location"); aggregateManager.Ask(cmd); ExpectMsg <DomainEvent <Device, DeviceId, LocationSetEvent> >( x => x.AggregateIdentity.Equals(aggregateId) && x.AggregateEvent.Location == "Updated Location", TimeSpan.FromSeconds(10)); }
public void InitialState_AfterSetLocationCommand_LocationSetEventEmitted_UsingTell() { var probe = CreateTestActor("probeActor"); Sys.EventStream.Subscribe(probe, typeof(DomainEvent <Device, DeviceId, LocationSetEvent>)); var aggregateManager = Sys.ActorOf(Props.Create(() => new DeviceManager()), "test-devicemanager"); var aggregateId = TestAggregateId; var command = new AddDeviceCommand(aggregateId, "16777215", "127.0.0.1"); var nextCommand = new SetLocationCommand(aggregateId, "Default"); aggregateManager.Tell(command); aggregateManager.Tell(nextCommand); ExpectMsg <DomainEvent <Device, DeviceId, LocationSetEvent> >( x => x.AggregateIdentity.Equals(aggregateId) && x.AggregateEvent.Location == "Default"); }