Make the bet_place helper in the test fixture return the bet id

This commit is contained in:
Eric Frias 2017-08-09 13:53:37 -04:00
parent 8fd01c8af7
commit 26c2eb4c7a
2 changed files with 4 additions and 2 deletions

View file

@ -1395,7 +1395,7 @@ void database_fixture::update_betting_market(betting_market_id_type betting_mark
} FC_CAPTURE_AND_RETHROW( (betting_market_id) (group_id) (payout_condition) ) }
void database_fixture::place_bet(account_id_type bettor_id, betting_market_id_type betting_market_id, bet_type back_or_lay, asset amount_to_bet, bet_multiplier_type backer_multiplier)
bet_id_type database_fixture::place_bet(account_id_type bettor_id, betting_market_id_type betting_market_id, bet_type back_or_lay, asset amount_to_bet, bet_multiplier_type backer_multiplier)
{ try {
bet_place_operation bet_place_op;
bet_place_op.bettor_id = bettor_id;
@ -1408,6 +1408,8 @@ void database_fixture::update_betting_market(betting_market_id_type betting_mark
trx.validate();
processed_transaction ptx = db.push_transaction(trx, ~0);
trx.operations.clear();
BOOST_CHECK_MESSAGE(ptx.operation_results.size() == 1, "Place Bet Transaction should have had exactly one operation result");
return ptx.operation_results.front().get<object_id_type>().as<bet_id_type>();
} FC_CAPTURE_AND_RETHROW( (bettor_id)(back_or_lay)(amount_to_bet) ) }
void database_fixture::resolve_betting_market_group(betting_market_group_id_type betting_market_group_id,

View file

@ -319,7 +319,7 @@ struct database_fixture {
/*fc::optional<internationalized_string_type> description,*/
fc::optional<internationalized_string_type> payout_condition);
void place_bet(account_id_type bettor_id, betting_market_id_type betting_market_id, bet_type back_or_lay, asset amount_to_bet, bet_multiplier_type backer_multiplier);
bet_id_type place_bet(account_id_type bettor_id, betting_market_id_type betting_market_id, bet_type back_or_lay, asset amount_to_bet, bet_multiplier_type backer_multiplier);
void resolve_betting_market_group(betting_market_group_id_type betting_market_group_id, std::map<betting_market_id_type, betting_market_resolution_type> resolutions);
void cancel_unmatched_bets(betting_market_group_id_type betting_market_group_id);