namespace BrokerTest.Entity; using BrokerCore; using BrokerCore.Entity; using ServerCore; using ServerBase; using ServerCommon; public class EntityTests { private readonly BrokerServerLogic m_logic; // BrokerServerLogic 내에서 초기화 됨 private readonly DynamoDbClient m_dynamo_db_client; // BrokerServerLogic 내에서 초기화 됨 private readonly ServerConfigMetaverseBroker m_server_config; private const string TestAccountId = "20462"; // tenafter71@gmail.com public EntityTests() { var server_config = new ServerConfigMetaverseBroker(); var server_config_path = "./Config/ServerConfig.json"; server_config.setConfigFilePath(server_config_path); var result = server_config.tryLoadConfig().GetAwaiter().GetResult(); m_server_config = server_config; m_logic = new BrokerServerLogic(server_config); m_logic.onInit().Wait(); m_dynamo_db_client = m_logic.getDynamoDbClient(); } [Fact] public async Task userBaseTest() { // var server_logic = new BrokerServerLogic(); // var user = new UserEntity(); // var initializers = new Initializers(); // initializers.appendInitializer(user); // // foreach (var user_entity in initializers.getInitializers().Cast()) // { // _ = user_entity?.onInit(); // } // // var action = user.getEntityAction(); // var result = await action.onInit(); // result = await action.login("account_id"); // Assert.True(result.isSuccess()); await Task.CompletedTask; } [Fact] public async Task userAuthEntityTest() { await m_logic.onInit(); var user_entity = new PlanetUserEntity(m_logic); await user_entity.onInit(); var user_auth_action = user_entity.getEntityActionNotNull(); var (result, account_base_doc) = await user_auth_action.findAccountDoc(TestAccountId); var account_attribute = user_entity.getEntityAttributeNotNull(); account_attribute.copyEntityAttributeFromDoc(account_base_doc); Assert.Equal(TestAccountId, account_attribute.AccountId); var user_attribute = user_entity.getEntityAttributeNotNull(); (result, var user_doc) = await user_auth_action.findUserDoc(account_attribute.UserGuid); Assert.NotNull(user_doc); user_attribute.copyEntityAttributeFromDoc(user_doc); Assert.NotEmpty(user_attribute.UserGuid); Assert.Equal(TestAccountId, user_attribute.AccountId); Assert.Equal(account_attribute.UserGuid, user_attribute.UserGuid); await user_auth_action.findNicknameDoc(account_attribute.UserGuid); (result, var nickname_doc) = await user_auth_action.findNicknameDoc(account_attribute.UserGuid); Assert.NotNull(nickname_doc); var user_nickname = user_entity.getEntityAttribute(); Assert.NotNull(user_nickname); await user_nickname.onInit(); user_nickname.copyEntityAttributeFromDoc(nickname_doc); Assert.NotEmpty(user_nickname.Nickname); } }