private User CreateUser() { string name = "Fedor" + Guid.NewGuid().ToString(); _databaseDeployer.ExecuteNonQueryAsync($"INSERT INTO Users([Name]) VALUES('{name}')").Wait(); long id = _databaseDeployer.ExecuteReader($"SELECT TOP 1 Id FROM Users WHERE [Name]='{name}'", ReadTestUserId); return(new User(id, name)); }
private void DeployDatabase(IConfigurationRoot configuration) { _connectionString = configuration.GetConnectionString("DefaultConnection"); _databaseDeployer = new DatabaseDeployer(_connectionString, "Sql\\Schema.sql", "Sql\\Procedures.sql"); bool isDBCreated = _databaseDeployer.ExecuteReader("IF (OBJECT_ID ('dbo.GetBalance', 'P') IS NULL) SELECT 0 ELSE SELECT 1;", IsDatabaseCreated); if (!isDBCreated) { _databaseDeployer.DeployAsync().Wait(); } }