Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
agiledragon committed Jul 28, 2019
1 parent 9b8044a commit 7656bf8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/domain/model/remote-account/RemoteMoneyDest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
void RemoteMoneyDest::transferMoneyFrom(const std::string& fromId, U32 amount)
{
sendTransferToProtocolMsg(fromId, ROLE(AccountInfo).getAccountId(), amount);
Response resp = waitProtocolResp();
if (resp.isFailed)
Response ok = waitProtocolResp();
if (ok.isFailed)
{
throw "transfer money to remote fail!";
}
Expand Down
5 changes: 1 addition & 4 deletions test/TestAccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,33 +93,30 @@ struct TestAccount : testing::Test
FakeAccountRepo* accountRepo;
const U32 JIM_INIT_AMOUNT{10000};
const U32 LUCY_INIT_AMOUNT{5000};
const U32 AMOUNT{1500};
};

TEST_F(TestAccount, withdraw_money)
{
const U32 AMOUNT = 1500;
api->withdrawMoney(jimAccountId, AMOUNT);
ASSERT_EQ(JIM_INIT_AMOUNT - AMOUNT, api->getAmount(jimAccountId));
}

TEST_F(TestAccount, transfer_money_to_local)
{
const U32 AMOUNT = 1500;
api->transferMoneyToLocal(jimAccountId, lucyAccountId, AMOUNT);
ASSERT_EQ(JIM_INIT_AMOUNT - AMOUNT, api->getAmount(jimAccountId));
ASSERT_EQ(LUCY_INIT_AMOUNT + AMOUNT, api->getAmount(lucyAccountId));
}

TEST_F(TestAccount, transfer_money_to_remote)
{
const U32 AMOUNT = 1500;
api->transferMoneyToRemote(jimAccountId, lucyAccountId, AMOUNT);
ASSERT_EQ(JIM_INIT_AMOUNT - AMOUNT, api->getAmount(jimAccountId));
}

TEST_F(TestAccount, transfer_money_from_remote)
{
const U32 AMOUNT = 1500;
api->transferMoneyFromRemote(lucyAccountId, jimAccountId, AMOUNT);
ASSERT_EQ(JIM_INIT_AMOUNT + AMOUNT, api->getAmount(jimAccountId));
}
Expand Down

0 comments on commit 7656bf8

Please sign in to comment.