public SqlUnitOfWork(IDbConnection connection) { _connection = connection; _transaction = _connection.BeginTransaction(); _context = new FlowDataContext(_connection) { Transaction = (DbTransaction)_transaction }; FlowTemplates = new FlowTemplateRepository(_context); FlowTemplateSteps = new FlowTemplateStepRepository(_context); }
public FlowTemplateRepositoryTests() { _connection = new SqlConnection(LocalConnectionString); _connection.Open(); _transaction = _connection.BeginTransaction(); using (var command = new SqlCommand(@"INSERT INTO FlowTemplate (Name) VALUES ('Example Template 1');", _connection, _transaction)) { command.ExecuteNonQuery(); } _transaction.Save("insert"); _context = new FlowDataContext(_connection) { Transaction = _transaction }; _repository = new FlowTemplateRepository(_context); }