]> git.stg.codes - stg.git/blobdiff - tests/testtariffs.h
Test admin, settings, tariffs and store moved to separate files
[stg.git] / tests / testtariffs.h
diff --git a/tests/testtariffs.h b/tests/testtariffs.h
new file mode 100644 (file)
index 0000000..68279ac
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef __TEST_TARIFFS_H__
+#define __TEST_TARIFFS_H__
+
+#include "stg/tariffs.h"
+
+#include "tariff_impl.h"
+
+class TEST_TARIFFS : public TARIFFS {
+    public:
+        TEST_TARIFFS() {}
+
+        int            ReadTariffs () { return 0; }
+        const TARIFF * FindByName(const std::string & name) const { return &testTariff; }
+        const TARIFF * GetNoTariff() const { return NULL; }
+        int            GetTariffsNum() const { return 0; }
+        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; }
+
+        void           GetTariffsData(std::list<TARIFF_DATA> * tdl) {}
+
+        const std::string & GetStrError() const { return strError; }
+
+        void           SetFee(double fee);
+
+    private:
+        std::string strError;
+        TARIFF_IMPL testTariff;
+};
+
+inline
+void TEST_TARIFFS::SetFee(double fee)
+{
+    TARIFF_DATA td(testTariff.GetTariffData());
+    td.tariffConf.fee = fee;
+    testTariff = td;
+}
+
+#endif