public void SetAsCurrentWithConversation()
        {
            var tc = new ThreadLocalConversationContainerStub();

            Assert.Throws <ArgumentNullException>(() => tc.SetAsCurrent((IConversation)null));
            tc.Bind(new TestConversation());
            IConversation c = new TestConversation();

            tc.SetAsCurrent(c);
            Assert.That(tc.BindedConversationCount, Is.EqualTo(2));
            Assert.That(tc.CurrentConversation, Is.SameAs(c));
            tc.SetAsCurrent(c);
            Assert.That(tc.BindedConversationCount, Is.EqualTo(2), "a new conversation was added even if is contained.");
            Assert.That(tc.CurrentConversation, Is.SameAs(c));
            tc.Reset();
        }
        public void SetAsCurrentWithId()
        {
            var tc = new ThreadLocalConversationContainerStub();

            Assert.Throws <ArgumentNullException>(() => tc.SetAsCurrent((string)null));
            IConversation c1 = new TestConversation();

            tc.Bind(c1);
            IConversation c2 = new TestConversation();

            Assert.Throws <ConversationException>(() => tc.SetAsCurrent(c2.Id));
            Assert.That(tc.BindedConversationCount, Is.EqualTo(1));
            Assert.That(tc.CurrentConversation, Is.SameAs(c1));
            tc.Bind(c2);
            tc.SetAsCurrent(c2.Id);
            Assert.That(tc.CurrentConversation, Is.SameAs(c2));
            tc.Reset();
        }
        public void FullPlay()
        {
            var           tc1 = new ThreadLocalConversationContainerStub();
            var           tc2 = new ThreadLocalConversationContainerStub();
            IConversation c1  = new TestConversation();
            IConversation c2  = new TestConversation();

            tc1.Bind(c1);
            tc2.Bind(c2);

            Assert.That(tc1.BindedConversationCount, Is.EqualTo(2));
            Assert.That(tc2.CurrentConversation, Is.SameAs(c1));
            tc2.SetAsCurrent(c2);
            Assert.That(tc1.CurrentConversation, Is.SameAs(c2));
            Assert.That(tc1.Unbind(c2.Id), Is.SameAs(c2));
            Assert.That(tc1.BindedConversationCount, Is.EqualTo(1));
            Assert.That(tc2.CurrentConversation, Is.SameAs(c1));
            tc1.Reset();
        }