예제 #1
0
        public void ReturnsUsers_LastActivity()
        {
            var options = DbContextMock.GetOptions("ReturnsUsers_LastActivity");
            IReadOnlyCollection <UserDTO> lastOneMonth;
            IReadOnlyCollection <UserDTO> lastThreeMonth;
            IReadOnlyCollection <UserDTO> lastFourMonth;

            using (var context = new BubaTubeDbContext(options))
            {
                context.AddRange(UserMockData.GetListOfUserModels());
                context.SaveChanges();

                var userQueries = new UserQueries(context, fakeMapper);

                lastOneMonth   = userQueries.ByLastActivity(1);
                lastThreeMonth = userQueries.ByLastActivity(3);
                lastFourMonth  = userQueries.ByLastActivity(4);
            }

            Assert.Equal(1, lastOneMonth.Count);
            Assert.Equal(3, lastThreeMonth.Count);
            Assert.Equal(6, lastFourMonth.Count);
        }