internal static int PrepareTestData() { LoadDBConfig(); var builder = new DbContextOptionsBuilder <AccountContent>() .UseLoggerFactory(LogSettings.DebugLogger) .UseMySql(AccountControlerTest.ConnectionString); var context = new AccountContent(builder.Options); context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var users = Enumerable.Range(1, 10) .Select(i => new User { MyId = "TestID" + i, PassWord = "******" + i, NickName = "Mynick" + i, RegDate = DateTime.Now, IsSocialActive = false }); context.Users.AddRange(users); context.SaveChanges(); var testOpt = new DbContextOptionsBuilder <TestContext>() .UseLoggerFactory(LogSettings.DebugLogger) .UseMySql(AccountControlerTest.TestConnectionString); var testContext = new TestContext(testOpt.Options); testContext.Database.EnsureDeleted(); testContext.Database.EnsureCreated(); return(context.Users.Count(t => t.IsSocialActive == false)); }
public AccountService(AccountContent context, ActorSystem actorSystem) { _context = context; _actorSystem = actorSystem; System.Console.WriteLine("Actor System Check===" + actorSystem.Name); }
public ValuesController(AccountContent context) { _context = context; if (_context.Users.Count() == 0) { } }
public async Task <Account> CreateAccount(Guid accountMasterId) { AccountContent content = new AccountContent(accountMasterId); Account newEntity = new Account { Contents = content }; var entity = await _context.Account.AddAsync(newEntity); return(entity); }
protected void InitContext() { var builder = new DbContextOptionsBuilder <AccountContent>() .UseLoggerFactory(LogSettings.DebugLogger) .UseMySql(AccountControlerTest.ConnectionString); _context = new AccountContent(builder.Options); _actorSystem = ActorSystem.Create("accountapi"); _accountService = new AccountService(_context, _actorSystem); //For Test var testOpt = new DbContextOptionsBuilder <TestContext>() .UseLoggerFactory(LogSettings.DebugLogger) .UseMySql(AccountControlerTest.TestConnectionString); _testContext = new TestContext(testOpt.Options); _testContext2 = new TestContext(testOpt.Options); }