public void GetFilteredActivity_returns_empty_slots_with_no_activity()
        {
            // given
            var filterData = new ActivityFilterData(
                DateTime.Parse("2115-6-22"),
                DateTime.Parse("2116-9-22"),
                null,
                null,
                null,
                CourseFilterType.None,
                ReportInterval.Months
                );

            A.CallTo(
                () => activityDataService.GetFilteredActivity(
                    A <int> ._,
                    A <DateTime> ._,
                    A <DateTime> ._,
                    A <int?> ._,
                    A <int?> ._,
                    A <int?> ._
                    )
                )
            .Returns(new List <ActivityLog>());

            // when
            var result = activityService.GetFilteredActivity(101, filterData).ToList();

            // then
            using (new AssertionScope())
            {
                result.Count.Should().Be(16);
                result.All(p => p.Completions == 0 && p.Evaluations == 0 && p.Registrations == 0).Should().BeTrue();
            }
        }
        public void GetFilteredActivity_gets_expected_activity()
        {
            using var transaction = new TransactionScope();
            // given
            connection.Execute("UPDATE Applications SET DefaultContentTypeID = 4 WHERE ApplicationID = 23");

            // when
            var result = service.GetFilteredActivity(
                101,
                DateTime.Parse("2014-01-01 00:00:00.000"),
                DateTime.Parse("2014-01-31 23:59:59.999"),
                null,
                null,
                null
                )
                         .OrderBy(log => log.LogDate)
                         .ToList();

            // then
            using (new AssertionScope())
            {
                result.Count().Should().Be(9);

                var first = result.First();
                first.LogDate.Should().Be(DateTime.Parse("2014-01-08 11:04:35.753"));
                first.LogYear.Should().Be(2014);
                first.LogQuarter.Should().Be(1);
                first.LogMonth.Should().Be(1);
                first.Completed.Should().BeFalse();
                first.Evaluated.Should().BeFalse();
                first.Registered.Should().BeTrue();

                var last = result.Last();
                last.LogDate.Should().Be(DateTime.Parse("2014-01-31 09:43:28.840"));
                last.LogYear.Should().Be(2014);
                last.LogQuarter.Should().Be(1);
                last.LogMonth.Should().Be(1);
                last.Completed.Should().BeFalse();
                last.Evaluated.Should().BeFalse();
                last.Registered.Should().BeTrue();
            }
        }
Example #3
0
        public void GetFilteredActivity_gets_expected_activity()
        {
            // when
            var result = service.GetFilteredActivity(
                101,
                DateTime.Parse("2014-01-01 00:00:00.000"),
                DateTime.Parse("2014-01-31 23:59:59.999"),
                null,
                null,
                null
                )
                         .OrderBy(log => log.LogDate)
                         .ToList();

            // then
            using (new AssertionScope())
            {
                result.Count().Should().Be(13);

                var first = result.First();
                first.LogDate.Should().Be(DateTime.Parse("2014-01-08 11:04:35.753"));
                first.LogYear.Should().Be(2014);
                first.LogQuarter.Should().Be(1);
                first.LogMonth.Should().Be(1);
                first.Completed.Should().BeFalse();
                first.Evaluated.Should().BeFalse();
                first.Registered.Should().BeTrue();

                var last = result.Last();
                last.LogDate.Should().Be(DateTime.Parse("2014-01-31 09:43:28.840"));
                last.LogYear.Should().Be(2014);
                last.LogQuarter.Should().Be(1);
                last.LogMonth.Should().Be(1);
                last.Completed.Should().BeFalse();
                last.Evaluated.Should().BeFalse();
                last.Registered.Should().BeTrue();
            }
        }