Пример #1
0
        public void EmptyTest()
        {
            MockLoadingProgressCallback progressCallback = new MockLoadingProgressCallback();

            DummyContactId[]     dummyContactIds     = { };
            DummyPhoneNumberId[] DummyPhoneNumberIds = { };

            ConversationManager   conversationManager   = DummyConversationDataGenerator.GetConversationManager(dummyContactIds, DummyPhoneNumberIds, progressCallback);
            AggregateConversation aggregateConversation = new AggregateConversation(new List <IConversation>());

            Assert.AreEqual(0, aggregateConversation.MessageCount);
        }
Пример #2
0
        public void MessageCountTest()
        {
            DummyContactId[]     dummyContactIds     = { DummyContactId.Davola, DummyContactId.Obama, DummyContactId.NeverTexter };
            DummyPhoneNumberId[] DummyPhoneNumberIds = { DummyPhoneNumberId.DavolaCell, DummyPhoneNumberId.DavolaiPhone, DummyPhoneNumberId.ObamaCell, DummyPhoneNumberId.UnknownLawnmower };

            ConversationManager   conversationManager   = DummyConversationDataGenerator.GetConversationManager(dummyContactIds, DummyPhoneNumberIds, null);
            AggregateConversation aggregateConversation = new AggregateConversation(conversationManager);

            int expectedMessageCount = 0;

            foreach (DummyPhoneNumberId setId in DummyPhoneNumberIds)
            {
                expectedMessageCount += DummyConversationDataGenerator.GetMessageCount(setId);
            }

            Assert.AreEqual(expectedMessageCount, aggregateConversation.MessageCount);
        }
        public void CalculateAggregateConversationStatisticsTest()
        {
            IConversation[] conversations =
            {
                DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.TonyWolfCell),
                DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.VictoriaWolfCell),
            };
            AggregateConversation   aggregate   = new AggregateConversation(conversations);
            IConversationStatistics statsActual = ConversationStatisticsGenerator.CalculateStatistics(aggregate);

            int messagesSentExpected     = 31;
            int messagesReceivedExpected = aggregate.MessageCount - messagesSentExpected;
            int messagesTotalExpected    = aggregate.MessageCount;
            int daysTotalExpected        = 7;

            Assert.AreEqual(messagesSentExpected, statsActual.MessagesSent);
            Assert.AreEqual(messagesReceivedExpected, statsActual.MessagesReceived);
            Assert.AreEqual(messagesTotalExpected, statsActual.MessagesExchanged);
            Assert.AreEqual(daysTotalExpected, statsActual.DayCount);
        }