diff --git a/Tools/UnitTests/Source/TKernel/TUser_Tests.cpp b/Tools/UnitTests/Source/TKernel/TUser_Tests.cpp index 6e93dfa..7abaeb3 100644 --- a/Tools/UnitTests/Source/TKernel/TUser_Tests.cpp +++ b/Tools/UnitTests/Source/TKernel/TUser_Tests.cpp @@ -3,10 +3,40 @@ TOSHI_NAMESPACE_USING +static TUser testUser("Test"); +static TUser testUser2("AdventureT"); + TEST_CASE("Register User", "[TUser]") { - TUser user("AdventureT"); - TSHORT iUserID = user.Register(); + TSHORT iUserID = testUser.Register(); + + REQUIRE(iUserID != -1); + REQUIRE(TUserHandler::GetSingleton().FindUser("Test")); + REQUIRE(testUser.IsRegistered()); + + iUserID = testUser2.Register(); + REQUIRE(iUserID != -1); - REQUIRE(user.IsRegistered()); + REQUIRE(TUserHandler::GetSingleton().FindUser("AdventureT")); + REQUIRE(testUser.IsRegistered()); + + REQUIRE(TUserHandler::GetSingleton().FindUser("Toshi")); // This user is created in the ctor of TKernelInterface + REQUIRE(TUserHandler::GetSingleton().GetUserCount() == 3); +} + +TEST_CASE("Deregister User", "[TUser]") +{ + testUser.Deregister(); + + REQUIRE(!TUserHandler::GetSingleton().FindUser("Test")); + REQUIRE(!testUser.IsRegistered()); + + testUser2.Deregister(); + + REQUIRE(!TUserHandler::GetSingleton().FindUser("AdventureT")); + REQUIRE(!testUser2.IsRegistered()); + + REQUIRE(TUserHandler::GetSingleton().FindUser("Toshi")); // This user is created in the ctor of TKernelInterface + // The Users are still present, but not Registered + REQUIRE(TUserHandler::GetSingleton().GetUserCount() == 3); } \ No newline at end of file