public async Task ReturnNewAggregate_WhenGettingAggregate()
        {
            var result = await _sut.GetAsync(_aggregateId, _cancellationToken);

            result.Should().NotBeNull();
            result.Should().BeOfType <BankAccount>();
        }
    public Handlers(AggregateRepository repository)
    {
        Register <AdmitPatient>(async(command, ct) =>
        {
            var(patientId, patientName, ageInYears, _, wardNumber) = command;
            var encounter = new Encounter(patientId, patientName, ageInYears, wardNumber);
            await repository.SaveAsync(encounter, ct);
        });

        Register <TransferPatient>(async(command, ct) =>
        {
            var(patientId, wardNumber) = command;
            var encounter = await repository.GetAsync <Encounter>(patientId, ct);
            encounter.Transfer(wardNumber);
            await repository.SaveAsync(encounter, ct);
        });

        Register <DischargePatient>(async(command, ct) =>
        {
            var encounter = await repository.GetAsync <Encounter>(command.PatientId, ct);
            encounter.DischargePatient();
            await repository.SaveAsync(encounter, ct);
        });
    }
Beispiel #3
0
 public Task <CashoutRegistrationAggregate> GetAsync(Guid operationId)
 {
     return(_aggregateRepository.GetAsync(operationId));
 }
 public Task <HeartbeatCashoutAggregate> GetAsync(Guid operationId)
 {
     return(_aggregateRepository.GetAsync(operationId));
 }
Beispiel #5
0
 public Task <TransactionExecutionAggregate> GetAsync(Guid transactionId)
 {
     return(_aggregateRepository.GetAsync(transactionId));
 }
Beispiel #6
0
 protected override async Task<bool> ValidateCommandAsync(Todo aggregate, CreateTodo command)
 {
   var existing = await AggregateRepository.GetAsync<Todo>(command.AggregateId);
   return existing == null;
 }
 public Task <OperationExecutionAggregate> GetAsync(Guid operationId)
 {
     return(_aggregateRepository.GetAsync(operationId));
 }