20TEST(TransactionsNFTokenMintTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
48 builder.setTransferFee(transferFeeValue);
49 builder.setIssuer(issuerValue);
50 builder.setURI(uRIValue);
51 builder.setAmount(amountValue);
52 builder.setDestination(destinationValue);
53 builder.setExpiration(expirationValue);
55 auto tx = builder.build(publicKey, secretKey);
58 EXPECT_TRUE(tx.validate(reason)) << reason;
61 EXPECT_FALSE(tx.getSigningPubKey().empty());
62 EXPECT_TRUE(tx.hasTxnSignature());
65 EXPECT_EQ(tx.getAccount(), accountValue);
66 EXPECT_EQ(tx.getSequence(), sequenceValue);
67 EXPECT_EQ(tx.getFee(), feeValue);
71 auto const& expected = nFTokenTaxonValue;
72 auto const actual = tx.getNFTokenTaxon();
78 auto const& expected = transferFeeValue;
79 auto const actualOpt = tx.getTransferFee();
80 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfTransferFee should be present";
82 EXPECT_TRUE(tx.hasTransferFee());
86 auto const& expected = issuerValue;
87 auto const actualOpt = tx.getIssuer();
88 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfIssuer should be present";
90 EXPECT_TRUE(tx.hasIssuer());
94 auto const& expected = uRIValue;
95 auto const actualOpt = tx.getURI();
96 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfURI should be present";
98 EXPECT_TRUE(tx.hasURI());
102 auto const& expected = amountValue;
103 auto const actualOpt = tx.getAmount();
104 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfAmount should be present";
106 EXPECT_TRUE(tx.hasAmount());
110 auto const& expected = destinationValue;
111 auto const actualOpt = tx.getDestination();
112 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDestination should be present";
114 EXPECT_TRUE(tx.hasDestination());
118 auto const& expected = expirationValue;
119 auto const actualOpt = tx.getExpiration();
120 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfExpiration should be present";
122 EXPECT_TRUE(tx.hasExpiration());
129TEST(TransactionsNFTokenMintTests, BuilderFromStTxRoundTrip)
132 auto const [publicKey, secretKey] =
157 initialBuilder.setTransferFee(transferFeeValue);
158 initialBuilder.setIssuer(issuerValue);
159 initialBuilder.setURI(uRIValue);
160 initialBuilder.setAmount(amountValue);
161 initialBuilder.setDestination(destinationValue);
162 initialBuilder.setExpiration(expirationValue);
164 auto initialTx = initialBuilder.build(publicKey, secretKey);
169 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
172 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
175 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
176 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
177 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
181 auto const& expected = nFTokenTaxonValue;
182 auto const actual = rebuiltTx.getNFTokenTaxon();
188 auto const& expected = transferFeeValue;
189 auto const actualOpt = rebuiltTx.getTransferFee();
190 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfTransferFee should be present";
195 auto const& expected = issuerValue;
196 auto const actualOpt = rebuiltTx.getIssuer();
197 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfIssuer should be present";
202 auto const& expected = uRIValue;
203 auto const actualOpt = rebuiltTx.getURI();
204 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfURI should be present";
209 auto const& expected = amountValue;
210 auto const actualOpt = rebuiltTx.getAmount();
211 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfAmount should be present";
216 auto const& expected = destinationValue;
217 auto const actualOpt = rebuiltTx.getDestination();
218 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDestination should be present";
223 auto const& expected = expirationValue;
224 auto const actualOpt = rebuiltTx.getExpiration();
225 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfExpiration should be present";
260TEST(TransactionsNFTokenMintTests, OptionalFieldsReturnNullopt)
263 auto const [publicKey, secretKey] =
283 auto tx = builder.build(publicKey, secretKey);
286 EXPECT_FALSE(tx.hasTransferFee());
287 EXPECT_FALSE(tx.getTransferFee().has_value());
288 EXPECT_FALSE(tx.hasIssuer());
289 EXPECT_FALSE(tx.getIssuer().has_value());
290 EXPECT_FALSE(tx.hasURI());
291 EXPECT_FALSE(tx.getURI().has_value());
292 EXPECT_FALSE(tx.hasAmount());
293 EXPECT_FALSE(tx.getAmount().has_value());
294 EXPECT_FALSE(tx.hasDestination());
295 EXPECT_FALSE(tx.getDestination().has_value());
296 EXPECT_FALSE(tx.hasExpiration());
297 EXPECT_FALSE(tx.getExpiration().has_value());