public void CannotFlushAfterCancel() { using (var conv = new ScopedConversation(ConversationFlushMode.Explicit)) { conv.Cancel(); Assert.Throws<ActiveRecordException>(() => { conv.Flush(); }); } }
public void CannotFlushAfterCancel() { using (var conv = new ScopedConversation(ConversationFlushMode.Explicit)) { conv.Cancel(); Assert.Throws <ActiveRecordException>(() => { conv.Flush(); }); } }
public void CanCheckWhetherAConversationWasCanceled() { using (var c = new ScopedConversation()) { Assert.That(c.IsCanceled, Is.False); c.Cancel(); Assert.That(c.IsCanceled); } }
public void CanRestartAConversation() { using (var c = new ScopedConversation()) { Assert.That(c.IsCanceled, Is.False); c.Cancel(); Assert.That(c.IsCanceled); c.Restart(); Assert.That(c.IsCanceled, Is.False); } }
public void TriggersEventWhenCanceling() { bool triggered = false; using (var c = new ScopedConversation()) { c.Canceled += (conv, args) => triggered = true; c.Cancel(); } Assert.That(triggered); }
public void TriggersWithRightArgsWhenCanceling() { bool triggered = false; bool userCancel = false; using (var c = new ScopedConversation()) { c.Canceled += (conv, args) => { triggered = true; userCancel = args.CanceledByUser; }; c.Cancel(); } Assert.That(triggered); Assert.That(userCancel); }
public void ThrowsReasonableErrorMessageWhenUsedAfterCancel() { using (var conversation = new ScopedConversation()) { conversation.Cancel(); var ex = Assert.Throws <ActiveRecordException>(() => { using (new ConversationalScope(conversation)) BlogLazy.FindAll(); } ); Assert.That(ex.Message.Contains("cancel")); Assert.That(ex.Message.Contains("ConversationalScope")); Assert.That(ex.Message.Contains("session")); Assert.That(ex.Message.Contains("request")); } }
public void CanCancelConversations() { ArrangeRecords(); using (var conversation = new ScopedConversation()) { BlogLazy blog = null; using (new ConversationalScope(conversation)) { blog = BlogLazy.FindAll().First(); } blog.Author = "Somebody else"; using (new ConversationalScope(conversation)) { blog.SaveAndFlush(); } conversation.Cancel(); } Assert.That(BlogLazy.FindAll().First().Author, Is.EqualTo("Markus")); }
public void TriggersEventWhenCanceling() { bool triggered = false; using (var c = new ScopedConversation()) { c.Canceled += (conv,args) => triggered = true; c.Cancel(); } Assert.That(triggered); }
public void ThrowsReasonableErrorMessageWhenUsedAfterCancel() { using (var conversation = new ScopedConversation()) { conversation.Cancel(); var ex = Assert.Throws<ActiveRecordException>(() => { using (new ConversationalScope(conversation)) BlogLazy.FindAll(); } ); Assert.That(ex.Message.Contains("cancel")); Assert.That(ex.Message.Contains("ConversationalScope")); Assert.That(ex.Message.Contains("session")); Assert.That(ex.Message.Contains("request")); } }