]> git.stg.codes - stg.git/blob - tests/testtariffs.h
Non-virtual admin.
[stg.git] / tests / testtariffs.h
1 #ifndef __TEST_TARIFFS_H__
2 #define __TEST_TARIFFS_H__
3
4 #include "stg/tariffs.h"
5
6 #include "tariff_impl.h"
7
8 class TEST_TARIFFS : public STG::Tariffs {
9     public:
10         TEST_TARIFFS() : testTariff("") {}
11
12         int            ReadTariffs() override { return 0; }
13         const STG::Tariff * FindByName(const std::string & /*name*/) const override { return &testTariff; }
14         const STG::Tariff * GetNoTariff() const override { return NULL; }
15         int            Del(const std::string & /*name*/, const STG::Admin * /*admin*/) override { return 0; }
16         int            Add(const std::string & /*name*/, const STG::Admin * /*admin*/) override { return 0; }
17         int            Chg(const STG::TariffData & /*td*/, const STG::Admin * /*admin*/) override { return 0; }
18
19         void AddNotifierAdd(STG::NotifierBase<STG::TariffData> *) override {}
20         void DelNotifierAdd(STG::NotifierBase<STG::TariffData> *) override {}
21
22         void AddNotifierDel(STG::NotifierBase<STG::TariffData> *) override {}
23         void DelNotifierDel(STG::NotifierBase<STG::TariffData> *) override {}
24
25         void           GetTariffsData(std::vector<STG::TariffData> * /*tdl*/) const override {}
26
27         size_t         Count() const override { return 0; }
28
29         const std::string & GetStrError() const override { return strError; }
30
31         void           SetFee(double fee);
32
33     private:
34         std::string strError;
35         STG::TariffImpl testTariff;
36 };
37
38 inline
39 void TEST_TARIFFS::SetFee(double fee)
40 {
41     STG::TariffData td(testTariff.GetTariffData());
42     td.tariffConf.fee = fee;
43     testTariff = td;
44 }
45
46 #endif