Exemplo n.º 1
0
        public void ShouldSenderOrReceiverIdWorks()
        {
            // Arrange
            var conversationService = new ConversationService(agentService.Object, departmentService.Object, filterRepo.Object, filterExpressionFactory.Object, logRepo.Object);
            var rawConversations    = new List <Conversation>
            {
                new Conversation {
                    Id = 1, Subject = "Conversation Test 1", Messages = new List <Message> {
                        new Message {
                            SenderId = 1
                        }
                    }
                },
                new Conversation {
                    Id = 2, Note = "Conversation2", Messages = new List <Message> {
                        new Message {
                            ReceiverId = 1
                        }
                    }
                }
            }.AsQueryable();
            // Act
            var conversations = conversationService.ApplySenderOrReceiverId(rawConversations, 1).DefaultIfEmpty().ToList();

            // Assert
            Assert.Equal(2, conversations.Count());
        }