Files
DisplayFlow/tests/session/test_session_manager.cpp
huanglinhuan 91ae52eeb3 暂存文件
2025-12-12 21:54:52 +08:00

39 lines
912 B
C++

#include <gtest/gtest.h>
#include "displayflow/core/session/session_manager.h"
using namespace displayflow::core;
class SessionManagerTest : public ::testing::Test {
protected:
void SetUp() override {
manager_ = std::make_shared<SessionManager>();
}
void TearDown() override {
manager_.reset();
}
std::shared_ptr<SessionManager> manager_;
};
TEST_F(SessionManagerTest, CreateSession) {
auto session = manager_->CreateSession(RoleType::Host);
ASSERT_NE(session, nullptr);
EXPECT_EQ(session->GetRole(), RoleType::Host);
}
TEST_F(SessionManagerTest, GetSession) {
auto session = manager_->CreateSession(RoleType::Client);
ASSERT_NE(session, nullptr);
SessionId id = session->GetId();
auto retrieved = manager_->GetSession(id);
ASSERT_NE(retrieved, nullptr);
EXPECT_EQ(retrieved->GetId(), id);
}
// 添加更多测试...