本文整理汇总了C++中TA::addContributionStep方法的典型用法代码示例。如果您正苦于以下问题:C++ TA::addContributionStep方法的具体用法?C++ TA::addContributionStep怎么用?C++ TA::addContributionStep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TA
的用法示例。
在下文中一共展示了TA::addContributionStep方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST_F(ContributionLadder_Anciennitet_CONTEXT_KI_OSV_25_50, Bidragsstigningsform_Anciennitet_1_Step_POSITIVE) {
RuleEngine::_printDebugAtValidation = true;
TA ta { "15124040"}; // KonceptOid 4 - OSV
// ta.setValue(kUnionAgreementRelationship, kOUTSIDE);
ta.setValue(kPrivate_Taxed_MK, false);
ta.setValue(kBidragsstigningsform, "Anciennitet" );
ta.setValue(kHospitalsdaekning_MK, false);
auto r = re.validate(ta, false);
EXPECT_FALSE(r.isAllOk());
// if (r.isAllOk())
cout << r;
EXPECT_EQ(1, r.getValidationResults(kBidragstrappe).size());
EXPECT_TRUE(r.hasMessages(kBidragstrappe, kProductElementRequired));
ta.addContributionStep( {0, 1, 1} );
r = re.validate(ta, false);
EXPECT_FALSE(r.isAllOk());
// if (r.isAllOk())
cout << r;
EXPECT_EQ(1, r.getValidationResults(kBidragstrappe).size());
EXPECT_TRUE(r.hasMessages(kBidragstrappe, kValueUnderLimit));
ta.removeContributionStep( {0, 1, 1} );
ta.addContributionStep( {0, 3, 3} );
r = re.validate(ta, false);
EXPECT_TRUE(r.isAllOk());
// if (r.isAllOk())
cout << r;
}
示例2:
// Test kIndmeldelsesalder and getting options prior to that
TEST_F(ContributionLadder_Ingen_CONTEXT_KI_OSV_25_50, Bidragsstigningsform_Ingen_No_Hospitalsdaekning)
{
RuleEngine::_printDebugAtValidation = true;
TA ta { "15124040"}; // KonceptOid 4 - OSV
ta.setValue(kPrivate_Taxed_MK, false);
ta.setValue(kBidragsstigningsform, "Ingen");
// ta.setValue(kUnionAgreementRelationship, kOUTSIDE);
ta.setValue(kHospitalsdaekning_MK, false);
// expecting complains about missing step
auto r = re.validate(ta, false);
EXPECT_FALSE(r.isAllOk());
// if (r.isAllOk())
cout << r;
EXPECT_EQ(1, r.getValidationResults(kBidragstrappe).size());
EXPECT_TRUE(r.hasMessages(kBidragstrappe, kProductElementRequired));
r = re.validate(ta, (unsigned short) kBidragsstigningsform);
EXPECT_TRUE(r.isAllOk());
// if (r.isAllOk())
cout << r;
r = re.validate(ta, { kBidragsstigningsform, kBidragstrappe });
EXPECT_TRUE(r.isAllOk());
// if (r.isAllOk())
cout << r;
EXPECT_EQ(2, r.getWarnings(kBidragstrappe).size());
EXPECT_TRUE(r.hasWarnings(kBidragstrappe, kProductElementRequired));
// now add one step, but let it start from 3 (!=0), and it should fail
ta.addContributionStep( { 3, 3.4, 5.3 });
r = re.validate(ta, false);
EXPECT_FALSE(r.isAllOk());
// if (r.isAllOk())
cout << r;
EXPECT_TRUE(r.hasMessages(kBidragstrappe, kValueNotAllowed));
// now remove that step, and add one that starts from 0 and no complains
ta.removeContributionStep( { 3, 0, 0 });
ta.addContributionStep( { 0, 3.4, 5.3 });
r = re.validate(ta, false);
EXPECT_TRUE(r.isAllOk());
// if (!r.isAllOk())
cout << r;
// then add one more and it should complain again, that only 1 step is allowed, when "Ingen" is selected in Bidragsstigningsform
ta.addContributionStep( { 1, 4, 6 });
r = re.validate(ta, false);
EXPECT_FALSE(r.isAllOk());
// if (r.isAllOk())
cout << r;
EXPECT_TRUE(r.hasMessages(kBidragstrappe, kValueNotAllowed));
// now remove the last step (index!=0), and everything should be fine again
ta.removeContributionStep( { 1, 0, 0 });
r = re.validate(ta, false);
EXPECT_TRUE(r.isAllOk());
// if (!r.isAllOk())
cout << r;
}
示例3:
//.........这里部分代码省略.........
ta.setValue(kUdbetalingsform, re.getDefaultValue(kUdbetalingsform)->stringValue());
r = re.validate(ta, full);
EXPECT_TRUE(r.isAllOk());
if (!r.isAllOk()) cout << r;
ta.setValue(kUdbetalingsperiode, re.getDefaultValue(kUdbetalingsperiode)->longValue());
r = re.validate(ta, full);
EXPECT_TRUE(r.isAllOk());
if (!r.isAllOk()) cout << r;
ta.setValue(kMaxAndelLinkBidragPCT, (double) 5.5);
r = re.validate(ta, full);
EXPECT_TRUE(r.isAllOk());
if (!r.isAllOk()) cout << r;
ta.setValue(kMaxAndelMarkedspensionBidragPct, (double) 6.1);
r = re.validate(ta, full);
EXPECT_TRUE(r.isAllOk());
if (!r.isAllOk()) cout << r;
ta.setValue(kLinkKunForEgetBidrag_MK, true);
r = re.validate(ta, full);
EXPECT_TRUE(r.isAllOk());
if (!r.isAllOk()) cout << r;
//
// Invaliditetsdaekning
//
// ta.setValue(kInvalidesum);
//
//************************************************************
// SALARY PAGE
//************************************************************
//
//
// ***** Lon og betaling
//
ta.setValue(kLoenDefinition, "garbage");
r = re.validate(ta, full);
EXPECT_FALSE(r.isAllOk());
if (r.isAllOk()) cout << r;
ASSERT_EQ(1, r.getValidationResults(kLoenDefinition).size());
EXPECT_EQ(sbx::ValidationCode::kValueNotAllowed, r.getValidationResults(kLoenDefinition).at(0).getValidationCode());
ta.setValue(kLoenDefinition, re.getDefaultValue(kLoenDefinition)->stringValue());
ta.setValue(kLoenRegulering, "garbage");
r = re.validate(ta, full);
EXPECT_FALSE(r.isAllOk());
if (r.isAllOk()) cout << r;
ASSERT_EQ(1, r.getValidationResults(kLoenRegulering).size());
EXPECT_EQ(sbx::ValidationCode::kValueNotAllowed, r.getValidationResults(kLoenRegulering).at(0).getValidationCode());
ta.setValue(kLoenRegulering, "januar");
ta.setValue(kLoenreguleringsfrekvens, "garbage");
r = re.validate(ta, full);
EXPECT_FALSE(r.isAllOk());
if (r.isAllOk()) cout << r;
ASSERT_EQ(1, r.getValidationResults(kLoenreguleringsfrekvens).size());
EXPECT_EQ(sbx::ValidationCode::kValueNotAllowed, r.getValidationResults(kLoenreguleringsfrekvens).at(0).getValidationCode());
ta.setValue(kLoenreguleringsfrekvens, re.getDefaultValue(kLoenreguleringsfrekvens)->stringValue());
ta.setValue(kBidragsstigningsform, "garbage");
r = re.validate(ta, full);
EXPECT_FALSE(r.isAllOk());
if (r.isAllOk()) cout << r;
ASSERT_EQ(1, r.getValidationResults(kBidragsstigningsform).size());
EXPECT_EQ(sbx::ValidationCode::kValueNotAllowed, r.getValidationResults(kBidragsstigningsform).at(0).getValidationCode());
ta.setValue(kBidragsstigningsform, "Ingen");
ta.addContributionStep({0, 2, 2});
ta.setValue(kPrivate_Taxed_MK, true); // set privately taxed but no value for premium
ta.setValue(kPrivate_Taxed_Reguleringskode, "Pristal");
ta.setValue(kTAEReguleringskode, "Pristal");
ta.setValue(kTAEBlGrMin, 100000);
ta.setValue(kTAEBlOblMax, 200000);
ta.setValue(kDoedReguleringskode, "Pristal");
ta.setValue(kDoedBlGrMin, 400000);
ta.setValue(kDoedBlOblMax, 600000);
r = re.validate(ta, full); // ...and expect to fail
EXPECT_FALSE(r.isAllOk());
if (r.isAllOk()) cout << r;
EXPECT_TRUE(r.hasMessages(kPrivate_Premium_BL, kProductElementRequired));
EXPECT_TRUE(r.hasMessages(kPrivate_Taxed_SA_Administrated_MK, kProductElementRequired));
ta.setValue(kPrivate_Taxed_SA_Administrated_MK, true);
ta.setValue(kPrivate_Premium_BL, (double) 150234.5); // set a premium ...
ta.setValue(kHospitalsdaekning_MK, false);
r = re.validate(ta, full); // ... and expect not to fail
EXPECT_TRUE(r.isAllOk());
cout << r;
ta.setValue(kBidragEjFoesteTrin_MK, false); // set the
r = re.validate(ta, full);
EXPECT_TRUE(r.isAllOk());
cout << r;
}