public static int CreateUser(Config config, string username, string twofactorcode, string emailVerificationPath) { using (var connection = DbConnectionFactory.CreateAndOpen(config.Server, config.Database)) return(connection.Execute("insert into users (username, twofactorcode, isverified, VerificationExpiryDate, EmailVerificationPath) values (@username, @twofac, 0, @verifyDate, @verifyPath)", new { username = username, twofac = twofactorcode, verifyDate = DateTime.Now.AddDays(1), verifyPath = emailVerificationPath })); }
public static void Create() { var connection = DbConnectionFactory.CreateAndOpen(TestInstance, "master"); try { connection.Execute(Resources.SafeDropTestDb); } catch { } connection.Execute("Create database InsectTest"); connection.Execute(Resources.DropAndCreateDb); }
public LoginIntegrationTests() { DbCreator.Create(); conn = DbConnectionFactory.CreateAndOpen(DbCreator.TestInstance, TestDb); var config = new Config { Database = TestDb, Server = DbCreator.TestInstance }; userId = DbCreator.CreateUser(config, TestUser, TestTwoFactorCode, TestVerificationPath); var authStore = new AuthStore(config); _authService = new AuthenticationService(authStore); }
public AuthStore(Config config) { conn = DbConnectionFactory.CreateAndOpen(config.Server, config.Database); }