20TEST(TransactionsNFTokenCreateOfferTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
47 builder.setDestination(destinationValue);
48 builder.setOwner(ownerValue);
49 builder.setExpiration(expirationValue);
51 auto tx = builder.build(publicKey, secretKey);
54 EXPECT_TRUE(tx.validate(reason)) << reason;
57 EXPECT_FALSE(tx.getSigningPubKey().empty());
58 EXPECT_TRUE(tx.hasTxnSignature());
61 EXPECT_EQ(tx.getAccount(), accountValue);
62 EXPECT_EQ(tx.getSequence(), sequenceValue);
63 EXPECT_EQ(tx.getFee(), feeValue);
67 auto const& expected = nFTokenIDValue;
68 auto const actual = tx.getNFTokenID();
73 auto const& expected = amountValue;
74 auto const actual = tx.getAmount();
80 auto const& expected = destinationValue;
81 auto const actualOpt = tx.getDestination();
82 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDestination should be present";
84 EXPECT_TRUE(tx.hasDestination());
88 auto const& expected = ownerValue;
89 auto const actualOpt = tx.getOwner();
90 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfOwner should be present";
92 EXPECT_TRUE(tx.hasOwner());
96 auto const& expected = expirationValue;
97 auto const actualOpt = tx.getExpiration();
98 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfExpiration should be present";
100 EXPECT_TRUE(tx.hasExpiration());
107TEST(TransactionsNFTokenCreateOfferTests, BuilderFromStTxRoundTrip)
110 auto const [publicKey, secretKey] =
134 initialBuilder.setDestination(destinationValue);
135 initialBuilder.setOwner(ownerValue);
136 initialBuilder.setExpiration(expirationValue);
138 auto initialTx = initialBuilder.build(publicKey, secretKey);
143 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
146 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
149 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
150 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
151 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
155 auto const& expected = nFTokenIDValue;
156 auto const actual = rebuiltTx.getNFTokenID();
161 auto const& expected = amountValue;
162 auto const actual = rebuiltTx.getAmount();
168 auto const& expected = destinationValue;
169 auto const actualOpt = rebuiltTx.getDestination();
170 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDestination should be present";
175 auto const& expected = ownerValue;
176 auto const actualOpt = rebuiltTx.getOwner();
177 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfOwner should be present";
182 auto const& expected = expirationValue;
183 auto const actualOpt = rebuiltTx.getExpiration();
184 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfExpiration should be present";
219TEST(TransactionsNFTokenCreateOfferTests, OptionalFieldsReturnNullopt)
222 auto const [publicKey, secretKey] =
244 auto tx = builder.build(publicKey, secretKey);
247 EXPECT_FALSE(tx.hasDestination());
248 EXPECT_FALSE(tx.getDestination().has_value());
249 EXPECT_FALSE(tx.hasOwner());
250 EXPECT_FALSE(tx.getOwner().has_value());
251 EXPECT_FALSE(tx.hasExpiration());
252 EXPECT_FALSE(tx.getExpiration().has_value());