20TEST(TransactionsVaultWithdrawTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
46 builder.setDestination(destinationValue);
47 builder.setDestinationTag(destinationTagValue);
49 auto tx = builder.build(publicKey, secretKey);
52 EXPECT_TRUE(tx.validate(reason)) << reason;
55 EXPECT_FALSE(tx.getSigningPubKey().empty());
56 EXPECT_TRUE(tx.hasTxnSignature());
59 EXPECT_EQ(tx.getAccount(), accountValue);
60 EXPECT_EQ(tx.getSequence(), sequenceValue);
61 EXPECT_EQ(tx.getFee(), feeValue);
65 auto const& expected = vaultIDValue;
66 auto const actual = tx.getVaultID();
71 auto const& expected = amountValue;
72 auto const actual = tx.getAmount();
78 auto const& expected = destinationValue;
79 auto const actualOpt = tx.getDestination();
80 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDestination should be present";
82 EXPECT_TRUE(tx.hasDestination());
86 auto const& expected = destinationTagValue;
87 auto const actualOpt = tx.getDestinationTag();
88 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDestinationTag should be present";
90 EXPECT_TRUE(tx.hasDestinationTag());
97TEST(TransactionsVaultWithdrawTests, BuilderFromStTxRoundTrip)
100 auto const [publicKey, secretKey] =
123 initialBuilder.setDestination(destinationValue);
124 initialBuilder.setDestinationTag(destinationTagValue);
126 auto initialTx = initialBuilder.build(publicKey, secretKey);
131 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
134 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
137 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
138 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
139 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
143 auto const& expected = vaultIDValue;
144 auto const actual = rebuiltTx.getVaultID();
149 auto const& expected = amountValue;
150 auto const actual = rebuiltTx.getAmount();
156 auto const& expected = destinationValue;
157 auto const actualOpt = rebuiltTx.getDestination();
158 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDestination should be present";
163 auto const& expected = destinationTagValue;
164 auto const actualOpt = rebuiltTx.getDestinationTag();
165 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDestinationTag should be present";
200TEST(TransactionsVaultWithdrawTests, OptionalFieldsReturnNullopt)
203 auto const [publicKey, secretKey] =
225 auto tx = builder.build(publicKey, secretKey);
228 EXPECT_FALSE(tx.hasDestination());
229 EXPECT_FALSE(tx.getDestination().has_value());
230 EXPECT_FALSE(tx.hasDestinationTag());
231 EXPECT_FALSE(tx.getDestinationTag().has_value());