Beispiel #1
0
        public void AddTransaction_New_Returns1()
        {
            //Arrange
            var from    = new Guid("9CFE55DF-65E2-4204-BAD5-08D82BD21687");
            var to      = new Guid("9CFE55DF-65E2-4204-BAD5-08D82BD21687");
            var amount  = 0;
            var message = "";

            //Act
            var result = _service.AddTransaction(from, to, amount, out message);

            //Assert
            Assert.Equal("", message);
            Assert.True(result == 1);
        }
Beispiel #2
0
        public Task Handle(AddTransaction message, IMessageHandlerContext context)
        {
            string errorMessage;
            int    succeeded = _service.AddTransaction(message.FromAccount, message.ToAccount, message.Amount, out errorMessage);

            if (succeeded == 1)
            {
                _operationsHistoryService.AddOperationsHistory(message);
            }
            return(context.Publish(new TransactionAdded()
            {
                MessageId = message.MessageId,
                Message = errorMessage,
                Succeeded = succeeded,
            }));
        }
        public Task Handle(AddTransaction message, IMessageHandlerContext context)
        {
            string errorMessage;
            int    succeeded = _transactionService.AddTransaction(message.FromAccount, message.ToAccount, message.Amount, out errorMessage);

            _ = context.SendLocal(new AddOperation()
            {
                MessageId     = message.MessageId,
                Amount        = message.Amount,
                FromAccount   = message.FromAccount,
                ToAccount     = message.ToAccount,
                TransactionId = message.TransactionId,
                Succeeded     = succeeded == 1?true:false
            });
            return(context.Publish(new TransactionAdded()
            {
                MessageId = message.MessageId,
                Message = errorMessage,
                Succeeded = succeeded
            }));
        }