public static IConversationStatistics CalculateStatistics(IConversation conversation) { ConversationStatistics stats = new ConversationStatistics(); if (conversation == null) { return(stats); } Dictionary <DateTime, bool> datesSeen = new Dictionary <DateTime, bool>(); foreach (IConversationMessage message in conversation) { if (!datesSeen.ContainsKey(message.Timestamp.Date)) { datesSeen[message.Timestamp.Date] = true; stats.AddDay(); } if (message.IsOutgoing) { stats.AddSentMessage(); } else { stats.AddReceivedMessage(); } } return(stats); }
public static IConversationStatistics CalculateStatistics(IConversation conversation) { ConversationStatistics stats = new ConversationStatistics(); if (conversation == null) { return stats; } Dictionary<DateTime, bool> datesSeen = new Dictionary<DateTime, bool>(); foreach (IConversationMessage message in conversation) { if (!datesSeen.ContainsKey(message.Timestamp.Date)) { datesSeen[message.Timestamp.Date] = true; stats.AddDay(); } if (message.IsOutgoing) { stats.AddSentMessage(); } else { stats.AddReceivedMessage(); } } return stats; }
public bool Equals(ConversationStatistics other) { if (MessagesSent != other.MessagesSent) { return(false); } if (MessagesReceived != other.MessagesReceived) { return(false); } if (DayCount != other.DayCount) { return(false); } return(true); }
public bool Equals(ConversationStatistics other) { if (MessagesSent != other.MessagesSent) { return false; } if (MessagesReceived != other.MessagesReceived) { return false; } if (DayCount != other.DayCount) { return false; } return true; }
public void EmptyTest() { ConversationStatistics emptyStatistics = new ConversationStatistics(); VerifyStatisticsAllZero(emptyStatistics); }