public void CannotFlushAfterCancel()
 {
     using (var conv = new ScopedConversation(ConversationFlushMode.Explicit))
     {
         conv.Cancel();
         Assert.Throws<ActiveRecordException>(() => { conv.Flush(); });
     }
 }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 6
0
 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);
     }
 }
Ejemplo n.º 7
0
        public void TriggersEventWhenCanceling()
        {
            bool triggered = false;

            using (var c = new ScopedConversation())
            {
                c.Canceled += (conv, args) => triggered = true;
                c.Cancel();
            }

            Assert.That(triggered);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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 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 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 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"));
            }
        }