예제 #1
0
        public void Chat_Hours_Calculated_Correctly()
        {
            var factory = new ChatHourFactory();
            var hours = factory.GetChatHoursFromChats(Data.GetChatsForHours());

            Assert.AreEqual(2, hours.Count());
            Assert.AreEqual(2, hours.Where(hour => hour.Hour == 15).First().ChatsByDay.ChatCountStatistics.Sum);
            Assert.AreEqual(14, hours.Where(hour => hour.Hour == 15).First().ChatsByDay.LineStatistics.Mean);
            Assert.AreEqual(27, hours.Where(hour => hour.Hour == 15).First().ChatsByDay.MinuteStatistics.Mean);
            Assert.AreEqual(1, hours.Where(hour => hour.Hour == 18).Count());
        }
예제 #2
0
        public void Spanning_Hours_Calculated_Correctly_Only_One_Hour()
        {
            var factory = new ChatHourFactory();

            var times = factory.GetSpanningHours(
                new Chat()
                {
                    ChatDate = GetDateTime(8, 10),
                    Minutes = 30
                });

            Assert.AreEqual(times.Count(), 1);
            Assert.AreEqual(times.First().Hour, 8);
        }
예제 #3
0
        public void Spanning_Hours_Calculated_Correctly_Less_Than_Two_Hour_Span_Two_Hours()
        {
            var factory = new ChatHourFactory();

            var times = factory.GetSpanningHours(
                new Chat()
                {
                    ChatDate = GetDateTime(8, 12),
                    Minutes = 70
                });

            Assert.AreEqual(times.Count(), 2);
            Assert.AreEqual(times.First().Hour, 8);
            Assert.AreEqual(times.Last().Hour, 9);
        }
예제 #4
0
        public void Spanning_Hours_Calculated_Correctly_On_The_Hour()
        {
            var factory = new ChatHourFactory();

            var times = factory.GetSpanningHours(
                new Chat()
                {
                    ChatDate = GetDateTime(8, 0),
                    Minutes = 120
                });

            var list = times.ToList();
            Assert.AreEqual(list.Count, 3);
            Assert.AreEqual(list[0].Hour, 8);
            Assert.AreEqual(list[1].Hour, 9);
            Assert.AreEqual(list[2].Hour, 10);
        }
예제 #5
0
        public void Spanning_Hours_Calculated_Correctly_Spilling_Into_New_Day()
        {
            var factory = new ChatHourFactory();

            var times = factory.GetSpanningHours(
                new Chat()
                {
                    ChatDate = GetDateTime(23, 30),
                    Minutes = 60
                });

            Assert.AreEqual(times.Count(), 2);
            Assert.AreEqual(times.First().Hour, 23);
            Assert.AreEqual(times.Last().Hour, 0);
        }