/// <summary> /// 处理 /// </summary> /// <param name="event">领域事件</param> public Task HandleAsync(EntityCreatedEvent <Employee> @event) { var employee = @event.Entity; LastName = employee.LastName; return(Task.CompletedTask); }
public async Task Handle_SubscribeMultipleEventHandlers_TriggerAllHandlers() { var employee = new Employee("Allen", "Yeager", "1"); var @event = new EntityCreatedEvent <Employee>(employee); await _dispatcher.DispatchAsync(@event); Assert.Equal(employee.FirstName, EmployeeCreatedEventHandler1.FirstName); Assert.Equal(employee.LastName, EmployeeCreatedEventHandler2.LastName); }