]> git.stg.codes - stg.git/blobdiff - tests/testtariffs.h
More subscriptions, less notifiers.
[stg.git] / tests / testtariffs.h
index 2e4dd5f01a6ce104ef0b96b43e27e265d77e16d6..ca8ab0cea301230ad6d3ca6ff406a278cffc3204 100644 (file)
@@ -1,40 +1,35 @@
-#ifndef __TEST_TARIFFS_H__
-#define __TEST_TARIFFS_H__
+#pragma once
 
 #include "stg/tariffs.h"
 
 #include "tariff_impl.h"
 
-class TEST_TARIFFS : public TARIFFS {
+class TestTariffs : public STG::Tariffs
+{
     public:
-        TEST_TARIFFS() {}
+        TestTariffs() : m_tariff("") {}
 
-        int            ReadTariffs () { return 0; }
-        const TARIFF * FindByName(const std::string & /*name*/) const { return &testTariff; }
-        const TARIFF * GetNoTariff() const { return NULL; }
-        int            Del(const std::string & /*name*/, const ADMIN * /*admin*/) { return 0; }
-        int            Add(const std::string & /*name*/, const ADMIN * /*admin*/) { return 0; }
-        int            Chg(const TARIFF_DATA & /*td*/, const ADMIN * /*admin*/) { return 0; }
+        int            ReadTariffs() override { return 0; }
+        const STG::Tariff* FindByName(const std::string& /*name*/) const override { return &m_tariff; }
+        const STG::Tariff* GetNoTariff() const override { return NULL; }
+        int            Del(const std::string& /*name*/, const STG::Admin* /*admin*/) override { return 0; }
+        int            Add(const std::string& /*name*/, const STG::Admin* /*admin*/) override { return 0; }
+        int            Chg(const STG::TariffData& /*td*/, const STG::Admin* /*admin*/) override { return 0; }
 
-        void           GetTariffsData(std::list<TARIFF_DATA> * /*tdl*/) {}
+        void           GetTariffsData(std::vector<STG::TariffData>* /*tdl*/) const override {}
 
-        size_t         Count() const { return 0; }
+        size_t         Count() const override { return 0; }
 
-        const std::string & GetStrError() const { return strError; }
+        const std::string& GetStrError() const override { return m_errorStr; }
 
-        void           SetFee(double fee);
+        void           SetFee(double fee)
+        {
+            STG::TariffData td(m_tariff.GetTariffData());
+            td.tariffConf.fee = fee;
+            m_tariff = td;
+        }
 
     private:
-        std::string strError;
-        TARIFF_IMPL testTariff;
+        std::string m_errorStr;
+        STG::TariffImpl m_tariff;
 };
-
-inline
-void TEST_TARIFFS::SetFee(double fee)
-{
-    TARIFF_DATA td(testTariff.GetTariffData());
-    td.tariffConf.fee = fee;
-    testTariff = td;
-}
-
-#endif