3 #include "stg/settings.h"
4 #include "stg/user_property.h"
7 const volatile time_t stgTime = 0;
11 struct fee_charge_rules_data {
14 typedef test_group<fee_charge_rules_data> tg;
15 tg fee_charge_rules_test_group("Fee charge rules tests group");
17 typedef tg::object testobject;
19 class TEST_SETTINGS : public SETTINGS {
21 TEST_SETTINGS(unsigned _feeChargeType)
22 : feeChargeType(_feeChargeType) {}
24 const std::string & GetDirName(size_t) const { return dirName; }
25 const std::string & GetScriptsDir() const { return scriptsDir; }
26 unsigned GetDetailStatWritePeriod() const { return 10; }
27 unsigned GetStatWritePeriod() const { return 10; }
28 unsigned GetDayFee() const { return 0; }
29 bool GetFullFee() const { return false; }
30 unsigned GetDayResetTraff() const { return 0; }
31 bool GetSpreadFee() const { return false; }
32 bool GetFreeMbAllowInet() const { return false; }
33 bool GetDayFeeIsLastDay() const { return false; }
34 bool GetWriteFreeMbTraffCost() const { return false; }
35 bool GetShowFeeInCash() const { return false; }
36 unsigned GetMessageTimeout() const { return 0; }
37 unsigned GetFeeChargeType() const { return feeChargeType; }
38 const std::string & GetMonitorDir() const { return monitorDir; }
39 bool GetMonitoring() const { return false; }
43 std::string scriptsDir;
44 std::string monitorDir;
45 unsigned feeChargeType;
48 class TEST_TARIFFS : public TARIFFS {
52 int ReadTariffs () { return 0; }
53 const TARIFF * FindByName(const std::string & name) const { return NULL; }
54 const TARIFF * GetNoTariff() const { return NULL; }
55 int GetTariffsNum() const { return 0; }
56 int Del(const std::string & name, const ADMIN * admin) { return 0; }
57 int Add(const std::string & name, const ADMIN * admin) { return 0; }
58 int Chg(const TARIFF_DATA & td, const ADMIN * admin) { return 0; }
60 void GetTariffsData(std::list<TARIFF_DATA> * tdl) {}
62 const std::string & GetStrError() const { return strError; }
70 void testobject::test<1>()
72 set_test_name("Check classic rules");
74 TEST_SETTINGS settings(0);
76 USER_IMPL user(&settings, NULL, &tariffs, NULL, NULL);
78 USER_PROPERTY<double> & cash(user.GetProperty().cash);
80 ensure_equals("user.cash == 0", user.GetProperty().cash, 0);
82 ensure_equals("user.cash == 0", user.GetProperty().cash, 100);