EffectFixture.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * EffectFixture.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../../../lib/spells/effects/Effect.h"
  12. #include "../../../lib/spells/effects/Registry.h"
  13. #include "../../mock/mock_spells_Mechanics.h"
  14. #include "../../mock/mock_spells_Problem.h"
  15. #include "../../mock/mock_spells_Spell.h"
  16. #include "../../mock/mock_spells_SpellService.h"
  17. #include "../../mock/mock_IGameInfoCallback.h"
  18. #include "../../mock/mock_Creature.h"
  19. #include "../../mock/mock_CreatureService.h"
  20. #include "../../mock/mock_BonusBearer.h"
  21. #include "../../mock/mock_battle_IBattleState.h"
  22. #include "../../mock/mock_battle_Unit.h"
  23. #include "../../mock/mock_vstd_RNG.h"
  24. #if SCRIPTING_ENABLED
  25. #include "../../mock/mock_scripting_Pool.h"
  26. #endif
  27. #include "../../mock/BattleFake.h"
  28. #include "../../mock/mock_ServerCallback.h"
  29. #include "../../../lib/battle/CBattleInfoCallback.h"
  30. namespace battle
  31. {
  32. bool operator== (const Destination & left, const Destination & right);
  33. }
  34. bool operator==(const Bonus & b1, const Bonus & b2);
  35. namespace test
  36. {
  37. using namespace ::testing;
  38. using namespace ::spells;
  39. using namespace ::spells::effects;
  40. #if SCRIPTING_ENABLED
  41. using namespace ::scripting;
  42. #endif
  43. class EffectFixture
  44. {
  45. public:
  46. std::shared_ptr<Effect> subject;
  47. ProblemMock problemMock;
  48. StrictMock<MechanicsMock> mechanicsMock;
  49. StrictMock<CreatureServiceMock> creatureServiceMock;
  50. StrictMock<CreatureMock> creatureStub;
  51. StrictMock<SpellServiceMock> spellServiceMock;
  52. StrictMock<SpellMock> spellStub;
  53. StrictMock<IGameInfoCallbackMock> gameMock;
  54. vstd::RNGMock rngMock;
  55. battle::UnitsFake unitsFake;
  56. #if SCRIPTING_ENABLED
  57. std::shared_ptr<PoolMock> pool;
  58. #endif
  59. std::shared_ptr<battle::BattleFake> battleFake;
  60. StrictMock<ServerCallbackMock> serverMock;
  61. std::string effectName;
  62. EffectFixture(std::string effectName_);
  63. virtual ~EffectFixture();
  64. void setupEffect(const JsonNode & effectConfig);
  65. void setupEffect(Registry * registry, const JsonNode & effectConfig);
  66. void setupDefaultRNG();
  67. protected:
  68. void setUp();
  69. private:
  70. };
  71. }