コード例 #1
0
        public void CheckFindBySources()
        {
            // Arrange
            var conversationRepo = new Mock <IRepository <Conversation> >();

            conversationRepo.Setup(t => t.FindAll()).Returns(new List <Conversation>
            {
                new Conversation {
                    Id = 1, Subject = "Conversation Test 1", IsDeleted = false, IsHidden = false, Source = ConversationSource.FacebookMessage
                },
                new Conversation {
                    Id = 1, Subject = "Conversation Test 2", IsDeleted = false, IsHidden = false, Source = ConversationSource.FacebookVisitorPost
                }
            }.AsQueryable());

            var conversationService = new ConversationService(agentService.Object, departmentService.Object, filterRepo.Object, filterExpressionFactory.Object, logRepo.Object);

            conversationService.Repository = conversationRepo.Object;

            // Act
            var conversation = conversationService.Find(1, new ConversationSource[] { ConversationSource.FacebookVisitorPost, ConversationSource.FacebookWallPost });

            // Assert
            Assert.Equal("Conversation Test 2", conversation.Subject);
        }