mirror of
https://github.com/xtjoeytx/GServer-v2.git
synced 2026-05-08 16:49:48 -04:00
deb5d3b7df
Added BabyDI and migrated Server into it. Replaced pointers of server being passed around with calls to BabyDI.
29 lines
592 B
C++
29 lines
592 B
C++
#define CATCH_CONFIG_MAIN
|
|
#include "catch2/catch_all.hpp"
|
|
#include <BabyDI.h>
|
|
#include <Player.h>
|
|
#include <Server.h>
|
|
|
|
SCENARIO( "Player", "[object]" ) {
|
|
|
|
GIVEN( "Player" ) {
|
|
int id = 123;
|
|
auto* server = BabyDI_PROVIDE(Server, new Server("test"));
|
|
|
|
auto* socket = new CSocket();
|
|
auto* player = new Player((CSocket*)socket, id);
|
|
|
|
WHEN( "getting player id" ) {
|
|
THEN( "id should be " << id ) {
|
|
REQUIRE( player->getId() == id );
|
|
}
|
|
}
|
|
|
|
WHEN( "getting player servername" ) {
|
|
THEN( "name should be test" ) {
|
|
REQUIRE( player->getServerName() == "test" );
|
|
}
|
|
}
|
|
}
|
|
}
|