public async Task RegisterAccount(int count) { using (var dbContext = new DbContext()) { var accountService = new AccountDataService(dbContext); for (var i = 0; i < count; i++) { using (var dungeonCrawlApi = _dungeonCrawlApiFactory.Factory()) { dungeonCrawlApi.Proxy = new WebProxy(_proxyAddresses[i]); var name = await _nameGenerator.GenerateAsync(); var emailDomain = _emailDomainGenerator.Next().First(); var password = _passwordGenerator.Next().First(); var email = $"{name}@{emailDomain}"; await dungeonCrawlApi.ConnectAsync(_serverLabel.Url); await dungeonCrawlApi.RegisterAsync(name, password, email); accountService.Add(new DataBase.Account { Email = email, Name = name, Password = password }); } } } }