From: Maxim Mamontov Date: Thu, 26 May 2011 15:46:30 +0000 (+0300) Subject: Added unit-test for ReconnectOnTariffChange property X-Git-Tag: 2.408-alpha~130 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/9f3223722138dadc2f6cd54dfcbad3d19a3db4d6 Added unit-test for ReconnectOnTariffChange property --- diff --git a/tests/Makefile b/tests/Makefile index 43643cac..ac6e4e10 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -8,6 +8,7 @@ SOURCES=main.cpp \ test_tariff.cpp \ test_conffiles.cpp \ test_fee_charge_rules.cpp \ + test_reconnect_on_tariff_change.cpp \ ../projects/stargazer/tariff_impl.cpp \ ../projects/stargazer/user_impl.cpp \ ../projects/stargazer/user_property.cpp \ diff --git a/tests/test_reconnect_on_tariff_change.cpp b/tests/test_reconnect_on_tariff_change.cpp new file mode 100644 index 00000000..e60e5989 --- /dev/null +++ b/tests/test_reconnect_on_tariff_change.cpp @@ -0,0 +1,51 @@ +#include "tut/tut.hpp" + +#include "stg/user_property.h" +#include "user_impl.h" + +#include "testsettings.h" +#include "testtariffs.h" +#include "testadmin.h" +#include "teststore.h" + +namespace tut +{ + struct reconnect_on_tariff_change_data { + }; + + typedef test_group tg; + tg reconnect_on_tariff_change_test_group("Reconnect on tariff change tests group"); + + typedef tg::object testobject; + + class TEST_SETTINGS_LOCAL : public TEST_SETTINGS { + public: + TEST_SETTINGS_LOCAL(bool _reconnectOnTariffChange) + : reconnectOnTariffChange(_reconnectOnTariffChange) + {} + + bool GetReconnectOnTariffChange() const { return reconnectOnTariffChange; } + + private: + bool reconnectOnTariffChange; + }; + + template<> + template<> + void testobject::test<1>() + { + set_test_name("Check normal behaviour"); + + TEST_SETTINGS_LOCAL settings(false); + TEST_TARIFFS tariffs; + TEST_ADMIN admin; + TEST_STORE store; + USER_IMPL user(&settings, &store, &tariffs, &admin, NULL); + + USER_PROPERTY & tariffName(user.GetProperty().tariffName); + + ensure_equals("user.tariffName == NO_TARIFF_NAME", user.GetProperty().tariffName.ConstData(), NO_TARIFF_NAME); + tariffName = "test"; + ensure_equals("user.tariffName == 'test'", user.GetProperty().tariffName.ConstData(), "test"); + } +}