20TEST(TransactionsXChainModifyBridgeTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
44 builder.setSignatureReward(signatureRewardValue);
45 builder.setMinAccountCreateAmount(minAccountCreateAmountValue);
47 auto tx = builder.build(publicKey, secretKey);
50 EXPECT_TRUE(tx.validate(reason)) << reason;
53 EXPECT_FALSE(tx.getSigningPubKey().empty());
54 EXPECT_TRUE(tx.hasTxnSignature());
57 EXPECT_EQ(tx.getAccount(), accountValue);
58 EXPECT_EQ(tx.getSequence(), sequenceValue);
59 EXPECT_EQ(tx.getFee(), feeValue);
63 auto const& expected = xChainBridgeValue;
64 auto const actual = tx.getXChainBridge();
70 auto const& expected = signatureRewardValue;
71 auto const actualOpt = tx.getSignatureReward();
72 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfSignatureReward should be present";
74 EXPECT_TRUE(tx.hasSignatureReward());
78 auto const& expected = minAccountCreateAmountValue;
79 auto const actualOpt = tx.getMinAccountCreateAmount();
80 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMinAccountCreateAmount should be present";
82 EXPECT_TRUE(tx.hasMinAccountCreateAmount());
89TEST(TransactionsXChainModifyBridgeTests, BuilderFromStTxRoundTrip)
92 auto const [publicKey, secretKey] =
113 initialBuilder.setSignatureReward(signatureRewardValue);
114 initialBuilder.setMinAccountCreateAmount(minAccountCreateAmountValue);
116 auto initialTx = initialBuilder.build(publicKey, secretKey);
121 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
124 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
127 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
128 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
129 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
133 auto const& expected = xChainBridgeValue;
134 auto const actual = rebuiltTx.getXChainBridge();
140 auto const& expected = signatureRewardValue;
141 auto const actualOpt = rebuiltTx.getSignatureReward();
142 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfSignatureReward should be present";
147 auto const& expected = minAccountCreateAmountValue;
148 auto const actualOpt = rebuiltTx.getMinAccountCreateAmount();
149 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMinAccountCreateAmount should be present";
184TEST(TransactionsXChainModifyBridgeTests, OptionalFieldsReturnNullopt)
187 auto const [publicKey, secretKey] =
207 auto tx = builder.build(publicKey, secretKey);
210 EXPECT_FALSE(tx.hasSignatureReward());
211 EXPECT_FALSE(tx.getSignatureReward().has_value());
212 EXPECT_FALSE(tx.hasMinAccountCreateAmount());
213 EXPECT_FALSE(tx.getMinAccountCreateAmount().has_value());