示例#1
0
        public void unmatchWithConversationTest()
        {
            Conversation conversation1 = new Conversation("Konfa 1", 1);
            IUser        user1         = new User("Pan A");

            bool hasConversation1     = false;
            bool hasWrongConversation = false;

            foreach (var conversation in user1.Conversations)
            {
                hasWrongConversation = true;
            }
            Assert.IsFalse(hasWrongConversation);
            hasWrongConversation = false;

            user1.MatchWithConversation(conversation1);

            foreach (var conversation in user1.Conversations)
            {
                if (conversation == conversation1)
                {
                    hasConversation1 = true;
                }
                else
                {
                    hasWrongConversation = true;
                }
            }
            Assert.IsTrue(hasConversation1);
            Assert.IsFalse(hasWrongConversation);
            hasConversation1     = false;
            hasWrongConversation = false;

            bool methodResult;

            methodResult = user1.UnmatchWithConversation(conversation1);
            Assert.IsTrue(methodResult);

            foreach (var conversation in user1.Conversations)
            {
                hasWrongConversation = true;
            }
            Assert.IsFalse(hasWrongConversation);
            hasWrongConversation = false;

            methodResult = user1.UnmatchWithConversation(conversation1);
            Assert.IsFalse(methodResult);
        }