public void TestSaveNull() { StandardBroker <Bean> broker = new StandardBroker <Bean>("name"); TestStore <Bean> .ExceptionOnCall = false; broker.Save(null, null); }
public void TestSave() { StandardBroker <Bean> broker = new StandardBroker <Bean>("name"); TestStore <Bean> .ExceptionOnCall = false; Assert.IsNotNull(broker.Save(new Bean(), null)); }
public void TestSaveTransactionScope() { StandardBroker <Bean> broker = new StandardBroker <Bean>("name"); TestStore <Bean> .ExceptionOnCall = false; Assert.IsNotNull(broker.Save(new Bean(), null)); Assert.IsTrue(TestStore <Bean> .IsCallWithTransactionScope); }
public void TestSaveTransactionComplete() { StandardBroker <Bean> broker = new StandardBroker <Bean>("name"); TestStore <Bean> .ExceptionOnCall = false; using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { Assert.IsNotNull(broker.Save(new Bean(), null)); tx.Complete(); } Assert.IsTrue(TestStore <Bean> .IsCallWithTransactionScope); }
public void TestSaveTransactionRollback() { StandardBroker <Bean> broker = new StandardBroker <Bean>("name"); TestStore <Bean> .ExceptionOnCall = true; using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { try { broker.Save(new Bean(), null); } catch { // On intercepte l'exception. } tx.Complete(); } Assert.IsTrue(TestStore <Bean> .IsCallWithTransactionScope); }