+ template<>
+ template<>
+ void testobject::test<2>()
+ {
+ set_test_name("Check second rules (allow fee if cash value is positive)");
+
+ TEST_SETTINGS_LOCAL settings(1);
+ TEST_TARIFFS tariffs;
+ TEST_ADMIN admin;
+ TEST_STORE store;
+ USER_IMPL user(&settings, &store, &tariffs, &admin, NULL);
+
+ USER_PROPERTY<double> & cash(user.GetProperty().cash);
+ USER_PROPERTY<std::string> & tariffName(user.GetProperty().tariffName);
+
+ ensure_equals("user.cash == 0", user.GetProperty().cash, 0);
+ cash = 100;
+ ensure_equals("user.cash == 100", user.GetProperty().cash, 100);
+
+ tariffs.SetFee(50);
+ tariffName = "test";
+ ensure_equals("user.tariffName == 'test'", user.GetProperty().tariffName.ConstData(), "test");
+ user.ProcessDayFee();
+ ensure_equals("user.cash == 50", user.GetProperty().cash, 50);
+ user.ProcessDayFee();
+ ensure_equals("user.cash == 0", user.GetProperty().cash, 0);
+ user.ProcessDayFee();
+ ensure_equals("user.cash == 0", user.GetProperty().cash, -50);
+ cash = 49;
+ ensure_equals("user.cash == 49", user.GetProperty().cash, 49);
+ user.ProcessDayFee();
+ ensure_equals("user.cash == -1", user.GetProperty().cash, -1);
+ }