Exemplo n.º 1
0
        public void TwoVisits()
        {
            var time   = DateTime.Now;
            var visits = new List <VisitRecord>
            {
                new VisitRecord(1, 10, time, SlideType.Exercise),
                new VisitRecord(1, 11, time + TimeSpan.FromMinutes(2), SlideType.Exercise)
            };
            var median = StatisticsTask.GetMedianTimePerSlide(visits, SlideType.Exercise);

            Assert.AreEqual(2, median, 1e-5);
        }
Exemplo n.º 2
0
        private static void Main()
        {
            var encoding     = Encoding.GetEncoding(1251);
            var slideRecords = ParsingTask.ParseSlideRecords(File.ReadAllLines("slides.txt", encoding));
            var visitRecords = ParsingTask.ParseVisitRecords(File.ReadAllLines("visits.txt", encoding), slideRecords).ToList();

            foreach (var slideType in new[] { SlideType.Theory, SlideType.Exercise, SlideType.Quiz })
            {
                var time = StatisticsTask.GetMedianTimePerSlide(visitRecords, slideType);
                Console.WriteLine("Median time per slide '{0}': {1} mins", slideType, time);
            }
        }
Exemplo n.º 3
0
        public void ManyVisitsOfOneUser()
        {
            var time   = DateTime.Now;
            var visits = new List <VisitRecord>
            {
                new VisitRecord(1, 10, time, SlideType.Exercise),
                new VisitRecord(1, 11, time + TimeSpan.FromMinutes(2), SlideType.Exercise),
                new VisitRecord(1, 12, time + TimeSpan.FromMinutes(4), SlideType.Exercise),
                new VisitRecord(1, 13, time + TimeSpan.FromMinutes(8), SlideType.Quiz),
                new VisitRecord(1, 14, time + TimeSpan.FromMinutes(100), SlideType.Exercise)
            };
            var median = StatisticsTask.GetMedianTimePerSlide(visits, SlideType.Exercise);

            Assert.AreEqual(2, median, 1e-5);
        }
Exemplo n.º 4
0
        public void NoVisits()
        {
            var median = StatisticsTask.GetMedianTimePerSlide(new List <VisitRecord>(), SlideType.Exercise);

            Assert.AreEqual(0, median, 1e-5);
        }