2022-11-07 08:12:35 +00:00
|
|
|
#ifndef __GAMEDEPENDENCIES__H__
|
|
|
|
#define __GAMEDEPENDENCIES__H__
|
|
|
|
|
|
|
|
#include "Game.h"
|
|
|
|
#include "dLogger.h"
|
|
|
|
#include "dServer.h"
|
2023-01-07 05:17:05 +00:00
|
|
|
#include "EntityInfo.h"
|
2022-11-07 08:12:35 +00:00
|
|
|
#include "EntityManager.h"
|
2023-05-03 07:38:38 +00:00
|
|
|
#include "Database.h"
|
2023-01-12 06:36:03 +00:00
|
|
|
#include "dConfig.h"
|
2022-11-28 00:48:46 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
2022-11-07 08:12:35 +00:00
|
|
|
class dZoneManager;
|
|
|
|
class AssetManager;
|
|
|
|
|
|
|
|
class dServerMock : public dServer {
|
2022-11-28 00:48:46 +00:00
|
|
|
RakNet::BitStream* sentBitStream = nullptr;
|
2022-11-07 08:12:35 +00:00
|
|
|
public:
|
|
|
|
dServerMock() {};
|
|
|
|
~dServerMock() {};
|
2022-11-28 00:48:46 +00:00
|
|
|
RakNet::BitStream* GetMostRecentBitStream() { return sentBitStream; };
|
|
|
|
void Send(RakNet::BitStream* bitStream, const SystemAddress& sysAddr, bool broadcast) override { sentBitStream = bitStream; };
|
2022-11-07 08:12:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class GameDependenciesTest : public ::testing::Test {
|
|
|
|
protected:
|
|
|
|
void SetUpDependencies() {
|
|
|
|
info.pos = NiPoint3::ZERO;
|
|
|
|
info.rot = NiQuaternion::IDENTITY;
|
|
|
|
info.scale = 1.0f;
|
|
|
|
info.spawner = nullptr;
|
|
|
|
info.lot = 999;
|
|
|
|
Game::logger = new dLogger("./testing.log", true, true);
|
|
|
|
Game::server = new dServerMock();
|
2023-01-12 06:36:03 +00:00
|
|
|
Game::config = new dConfig("worldconfig.ini");
|
2023-05-03 07:38:38 +00:00
|
|
|
Database::Connect(Game::config->GetValue("mysql_host"), Game::config->GetValue("mysql_database"), Game::config->GetValue("mysql_username"), Game::config->GetValue("mysql_password"));
|
2022-11-07 08:12:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TearDownDependencies() {
|
|
|
|
if (Game::server) delete Game::server;
|
|
|
|
delete EntityManager::Instance();
|
|
|
|
if (Game::logger) {
|
|
|
|
Game::logger->Flush();
|
|
|
|
delete Game::logger;
|
|
|
|
}
|
2023-01-12 06:36:03 +00:00
|
|
|
if (Game::config) delete Game::config;
|
2022-11-07 08:12:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EntityInfo info;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //!__GAMEDEPENDENCIES__H__
|