暂存文件
This commit is contained in:
38
tests/session/test_session_manager.cpp
Normal file
38
tests/session/test_session_manager.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
// 添加更多测试...
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user