20TEST(TransactionsMPTokenIssuanceSetTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
43 mPTokenIssuanceIDValue,
57 auto tx = builder.
build(publicKey, secretKey);
60 EXPECT_TRUE(tx.validate(reason)) << reason;
63 EXPECT_FALSE(tx.getSigningPubKey().empty());
64 EXPECT_TRUE(tx.hasTxnSignature());
67 EXPECT_EQ(tx.getAccount(), accountValue);
68 EXPECT_EQ(tx.getSequence(), sequenceValue);
69 EXPECT_EQ(tx.getFee(), feeValue);
73 auto const& expected = mPTokenIssuanceIDValue;
74 auto const actual = tx.getMPTokenIssuanceID();
80 auto const& expected = holderValue;
81 auto const actualOpt = tx.getHolder();
82 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfHolder should be present";
84 EXPECT_TRUE(tx.hasHolder());
88 auto const& expected = domainIDValue;
89 auto const actualOpt = tx.getDomainID();
90 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDomainID should be present";
92 EXPECT_TRUE(tx.hasDomainID());
96 auto const& expected = mPTokenMetadataValue;
97 auto const actualOpt = tx.getMPTokenMetadata();
98 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMPTokenMetadata should be present";
100 EXPECT_TRUE(tx.hasMPTokenMetadata());
104 auto const& expected = transferFeeValue;
105 auto const actualOpt = tx.getTransferFee();
106 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfTransferFee should be present";
108 EXPECT_TRUE(tx.hasTransferFee());
112 auto const& expected = mutableFlagsValue;
113 auto const actualOpt = tx.getMutableFlags();
114 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMutableFlags should be present";
116 EXPECT_TRUE(tx.hasMutableFlags());
120 auto const& expected = issuerEncryptionKeyValue;
121 auto const actualOpt = tx.getIssuerEncryptionKey();
122 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfIssuerEncryptionKey should be present";
124 EXPECT_TRUE(tx.hasIssuerEncryptionKey());
128 auto const& expected = auditorEncryptionKeyValue;
129 auto const actualOpt = tx.getAuditorEncryptionKey();
130 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfAuditorEncryptionKey should be present";
132 EXPECT_TRUE(tx.hasAuditorEncryptionKey());
139TEST(TransactionsMPTokenIssuanceSetTests, BuilderFromStTxRoundTrip)
142 auto const [publicKey, secretKey] =
163 mPTokenIssuanceIDValue,
176 auto initialTx = initialBuilder.
build(publicKey, secretKey);
181 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
184 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
187 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
188 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
189 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
193 auto const& expected = mPTokenIssuanceIDValue;
194 auto const actual = rebuiltTx.getMPTokenIssuanceID();
200 auto const& expected = holderValue;
201 auto const actualOpt = rebuiltTx.getHolder();
202 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfHolder should be present";
207 auto const& expected = domainIDValue;
208 auto const actualOpt = rebuiltTx.getDomainID();
209 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDomainID should be present";
214 auto const& expected = mPTokenMetadataValue;
215 auto const actualOpt = rebuiltTx.getMPTokenMetadata();
216 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMPTokenMetadata should be present";
221 auto const& expected = transferFeeValue;
222 auto const actualOpt = rebuiltTx.getTransferFee();
223 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfTransferFee should be present";
228 auto const& expected = mutableFlagsValue;
229 auto const actualOpt = rebuiltTx.getMutableFlags();
230 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMutableFlags should be present";
235 auto const& expected = issuerEncryptionKeyValue;
236 auto const actualOpt = rebuiltTx.getIssuerEncryptionKey();
237 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfIssuerEncryptionKey should be present";
242 auto const& expected = auditorEncryptionKeyValue;
243 auto const actualOpt = rebuiltTx.getAuditorEncryptionKey();
244 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfAuditorEncryptionKey should be present";
279TEST(TransactionsMPTokenIssuanceSetTests, OptionalFieldsReturnNullopt)
282 auto const [publicKey, secretKey] =
295 mPTokenIssuanceIDValue,
302 auto tx = builder.
build(publicKey, secretKey);
305 EXPECT_FALSE(tx.hasHolder());
306 EXPECT_FALSE(tx.getHolder().has_value());
307 EXPECT_FALSE(tx.hasDomainID());
308 EXPECT_FALSE(tx.getDomainID().has_value());
309 EXPECT_FALSE(tx.hasMPTokenMetadata());
310 EXPECT_FALSE(tx.getMPTokenMetadata().has_value());
311 EXPECT_FALSE(tx.hasTransferFee());
312 EXPECT_FALSE(tx.getTransferFee().has_value());
313 EXPECT_FALSE(tx.hasMutableFlags());
314 EXPECT_FALSE(tx.getMutableFlags().has_value());
315 EXPECT_FALSE(tx.hasIssuerEncryptionKey());
316 EXPECT_FALSE(tx.getIssuerEncryptionKey().has_value());
317 EXPECT_FALSE(tx.hasAuditorEncryptionKey());
318 EXPECT_FALSE(tx.getAuditorEncryptionKey().has_value());