public void Should_add_item_to_context() { var expectedCount = _context.FlowTemplates.Count() + 1; var instance = new FlowTemplate { Name = "Example Template 2" }; _repository.Add(instance); _context.SubmitChanges(); Assert.Equal(expectedCount, _context.FlowTemplates.Count()); }
public FlowTemplateStepRepositoryTests() { _connection = new SqlConnection(LocalConnectionString); _connection.Open(); _transaction = _connection.BeginTransaction(); _context = new FlowDataContext(_connection) { Transaction = _transaction }; newTemplate = new FlowTemplate { Name = "Example Template 1" }; _context.FlowTemplates.InsertOnSubmit(newTemplate); _context.SubmitChanges(); startStep = new Library.Data.FlowTemplateStep { FlowTemplateId = newTemplate.Id, Name = "Example StartStep 1", StepTypeId = 1 }; collectDataStep = new Library.Data.FlowTemplateStep { FlowTemplateId = newTemplate.Id, Name = "Example CollectDataStep 2", StepTypeId = 3 }; storeDataStep = new Library.Data.FlowTemplateStep { FlowTemplateId = newTemplate.Id, Name = "Example StoreDataStep 3", StepTypeId = 4 }; stopStep = new Library.Data.FlowTemplateStep { FlowTemplateId = newTemplate.Id, Name = "Example StopStep 4", StepTypeId = 2 }; _context.FlowTemplateSteps.InsertAllOnSubmit(new[] { startStep, collectDataStep, storeDataStep, stopStep }); _context.SubmitChanges(); _transaction.Save("insert"); _repository = new FlowTemplateStepRepository(_context); }
public void Save() { _context.SubmitChanges(); }
public void Commit() { _context.SubmitChanges(); _transaction.Commit(); }