Example #1
0
        public void Handle(DeleteAccountCharge command)
        {
            var company = _repository.Get(command.CompanyId);

            company.DeleteAccountCharge(command.AccountChargeId);

            _repository.Save(company, command.Id.ToString());
        }
        public void when_deleting_accountcharge_successfully()
        {
            var deleteAccountCharge = new DeleteAccountCharge
            {
                CompanyId       = _companyId,
                AccountChargeId = Guid.NewGuid()
            };

            _sut.When(deleteAccountCharge);

            var evt = _sut.ThenHasSingle <AccountChargeDeleted>();

            Assert.AreEqual(_companyId, evt.SourceId);
            Assert.AreEqual(deleteAccountCharge.AccountChargeId, evt.AccountChargeId);
        }
Example #3
0
        public object Delete(AccountChargeRequest request)
        {
            var existing = _dao.FindByAccountNumber(request.AccountNumber);

            if (existing == null)
            {
                throw new HttpError(HttpStatusCode.NotFound, "Account Not Found");
            }

            var deleteAccountCharge = new DeleteAccountCharge
            {
                AccountChargeId = existing.Id,
                CompanyId       = AppConstants.CompanyId
            };

            _commandBus.Send(deleteAccountCharge);

            return(new HttpResult(HttpStatusCode.OK, "OK"));
        }