EffectFixture.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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/JsonNode.h"
  30. #include "../../../lib/NetPacksBase.h"
  31. #include "../../../lib/battle/CBattleInfoCallback.h"
  32. namespace battle
  33. {
  34. bool operator== (const Destination & left, const Destination & right);
  35. }
  36. bool operator==(const Bonus & b1, const Bonus & b2);
  37. namespace test
  38. {
  39. using namespace ::testing;
  40. using namespace ::spells;
  41. using namespace ::spells::effects;
  42. #if SCRIPTING_ENABLED
  43. using namespace ::scripting;
  44. #endif
  45. class EffectFixture
  46. {
  47. public:
  48. std::shared_ptr<Effect> subject;
  49. ProblemMock problemMock;
  50. StrictMock<MechanicsMock> mechanicsMock;
  51. StrictMock<CreatureServiceMock> creatureServiceMock;
  52. StrictMock<CreatureMock> creatureStub;
  53. StrictMock<SpellServiceMock> spellServiceMock;
  54. StrictMock<SpellMock> spellStub;
  55. StrictMock<IGameInfoCallbackMock> gameMock;
  56. vstd::RNGMock rngMock;
  57. battle::UnitsFake unitsFake;
  58. #if SCRIPTING_ENABLED
  59. std::shared_ptr<PoolMock> pool;
  60. #endif
  61. std::shared_ptr<battle::BattleFake> battleFake;
  62. StrictMock<ServerCallbackMock> serverMock;
  63. std::string effectName;
  64. EffectFixture(std::string effectName_);
  65. virtual ~EffectFixture();
  66. void setupEffect(const JsonNode & effectConfig);
  67. void setupEffect(Registry * registry, const JsonNode & effectConfig);
  68. void setupDefaultRNG();
  69. protected:
  70. void setUp();
  71. private:
  72. };
  73. }