public PetTestsContext() { DBConn = GetNewDbConnection(); OnlineUserRepo = new OnlineUserRepository(GetRedisConnection()); PetColor1 = CfgRepo.CreatePetColor(new PetColorConfig() { Name = Guid.NewGuid().ToString().Substring(0, 5), ImagePath = "8clFw0e.jpg" }).Result; PetColor2 = CfgRepo.CreatePetColor(new PetColorConfig() { Name = Guid.NewGuid().ToString().Substring(0, 5), ImagePath = "8clFw0e.jpg" }).Result; PetSpecies1 = CfgRepo.CreatePetSpecies(new PetSpeciesConfig() { Name = Guid.NewGuid().ToString().Substring(0, 5), Description = "", BaseHealthPoints = 1000, ImagePath = "https://i.imgur.com/" }).Result; PetSpecies2 = CfgRepo.CreatePetSpecies(new PetSpeciesConfig() { Name = Guid.NewGuid().ToString().Substring(0, 5), Description = "", BaseHealthPoints = 1000, ImagePath = "https://i.imgur.com" }).Result; var uid1 = UserRepo.CreateUser(RandomUserNotPersisted()).Result.Value; var uid2 = UserRepo.CreateUser(RandomUserNotPersisted()).Result.Value; var users = UserRepo.RetrieveUsersByIds(uid1, uid2).Result; OwnerUser1 = users.AsList()[0]; OwnerUser2 = users.AsList()[1]; DBConn.Dispose(); }
public AdminTests(AdminTestsContext context) { this.context = context; ScopedDbConnection = context.GetNewDbConnection(); SingletonRedis = context.GetRedisConnection(); OnlineUserRepo = new OnlineUserRepository(SingletonRedis); }
public ShopTests(ShopTestsContext context) { this.Context = context; this.TestScopedDBConn = context.GetNewDbConnection(); this.SingletonRedis = context.GetRedisConnection(); this.OnlineUserRepo = context.OnlineUserRepo; }
public ShopTestsContext() { OnlineUserRepo = new OnlineUserRepository(GetRedisConnection()); DBConn = GetNewDbConnection(); ItemType1 = CfgRepo.CreateItemType(new ItemTypeConfig() { Name = Guid.NewGuid().ToString().Substring(0, 5), Description = "A sword" }).Result; ItemType2 = CfgRepo.CreateItemType(new ItemTypeConfig() { Name = Guid.NewGuid().ToString().Substring(0, 5), Description = "A shield" }).Result; var uid1 = UserRepo.CreateUser(RandomUserNotPersisted()).Result.Value; var uid2 = UserRepo.CreateUser(RandomUserNotPersisted()).Result.Value; Item1 = InventoryRepo.CreateItems(ItemType1, null).Result.First(); Item2 = InventoryRepo.CreateItems(ItemType2, null).Result.First(); var users = UserRepo.RetrieveUsersByIds(uid1, uid2).Result; OwnerUser1 = users.AsList()[0]; OwnerUser2 = users.AsList()[1]; DBConn.Dispose(); }
public DebugController( IWebSocketRepository webSocketRepository, DebugRepository debugRepository, OnlineUserRepository onlineUserRepository) { _webSocketRepository = webSocketRepository; _debugRepository = debugRepository; _onlineUserRepository = onlineUserRepository; }
public FileService( OnlineUserRepository onlineUserRepository, IServiceProvider serviceProvider, IUserService userService, IOptions <FileSettings> fileSettingsOptions, IWebSocketHandler webSocketHandler, ILogger <FileService> logger) { _random = new Random(); _onlineUserRepository = onlineUserRepository; _serviceProvider = serviceProvider; _userService = userService; _webSocketHandler = webSocketHandler; _logger = logger; _fileSettings = fileSettingsOptions.Value; }
public UserTestScope() { if (OnlineUserRepo == null) { lock (lockObj) if (OnlineUserRepo == null) { OnlineUserRepo = new OnlineUserRepository(GetRedisConnection()); } } ScopedDbConnection = GetNewDbConnection(); UserRepo = new UserRepository(new UserCacheRepository(GetRedisConnection()), new UserDbRepository(ScopedDbConnection), OnlineUserRepo); FriendRepo = new FriendshipDbRepository(ScopedDbConnection); var transactionScopeFactory = new TransactionScopeFactory(ScopedDbConnection); UserAccountDomain = new UserDomain(UserRepo, FriendRepo, JWTProvider, null, transactionScopeFactory); }
public WebSocketHandler( IOptions <WebSocketOption> options, IWebSocketRepository webSocketRepository, OnlineUserRepository onlineUserRepository, ILogger <WebSocketHandler> logger, IServiceProvider serviceProvider, IUserService userService, LockService lockService) { _webSocketRepository = webSocketRepository; _onlineUserRepository = onlineUserRepository; _logger = logger; _serviceProvider = serviceProvider; _userService = userService; _lockService = lockService; _random = new Random(); _options = options.Value; StartBackgroundWorks(); }
public NpcTestsContext() { { SingletonRedis = GetRedisConnection(); OnlineUserRepo = new OnlineUserRepository(SingletonRedis); DBConn = GetNewDbConnection(); ItemType1 = cfgRepo.CreateItemType(new ItemTypeConfig() { Name = Guid.NewGuid().ToString().Substring(0, 5), Description = "A sword" }).Result; ItemType2 = cfgRepo.CreateItemType(new ItemTypeConfig() { Name = Guid.NewGuid().ToString().Substring(0, 5), Description = "A shield" }).Result; var uid1 = UserRepo.CreateUser(RandomUserNotPersisted()).Result.Value; var uid2 = UserRepo.CreateUser(RandomUserNotPersisted()).Result.Value; var users = UserRepo.RetrieveUsersByIds(uid1, uid2).Result; User1 = users.AsList()[0]; User2 = users.AsList()[1]; DBConn.Dispose(); } }
public UserService(IServiceProvider serviceProvider, OnlineUserRepository onlineUserRepository) { _serviceProvider = serviceProvider; _onlineUserRepository = onlineUserRepository; }