public void Test_Distributed_Transaction_TransactionScope_CreateFlushComplete_Calls_DataModelHook(bool flush, bool complete) { var config2 = this.CreateSqliteClassicInMemoryConfiguration(null); var model2 = DataAccessModel.BuildDataAccessModel <ComplexPrimaryKeyDataAccessModel>(config2); var hook2 = new TestDataModelHook(); model2.AddHook(hook2); model2.Create(DatabaseCreationOptions.IfDatabaseNotExist); using (var scope = new TransactionScope()) { var cat = this.model.Cats.Create(); var coord = model2.Coordinates.Create(1); Console.WriteLine("==="); if (flush) { scope.Flush(); } if (complete) { scope.Complete(); } } Assert.AreEqual(complete ? 1 : 0, this.testDataModelHook.CommitCount); Assert.AreEqual(complete || !flush ? 0 : 1, this.testDataModelHook.RollbackCount); Assert.AreEqual(complete ? 1 : 0, hook2.CommitCount); Assert.AreEqual(complete || !flush ? 0 : 1, hook2.RollbackCount); }
public void SetUp() { this.testDataModelHook = new TestDataModelHook(); this.model.AddHook(this.testDataModelHook); }