示例#1
0
        public void FindAfter_Should_Return_Correct_Views()
        {
            using (BeginTransaction())
            {
                var view    = CreateNewStoryView();
                var storyId = view.Story.Id;
                _database.InsertOnSubmit(view);
                _database.SubmitChanges();

                var date  = view.ViewedAt.AddSeconds(-10);
                var count = _database.StoryViewDataSource
                            .Count(v => v.Story.Id == storyId && v.Timestamp >= date);

                var result = _storyViewRepository.FindAfter(storyId, date);

                Assert.Equal(count, result.Count);
            }
        }
示例#2
0
        public void FindAfter_Should_Return_Correct_Views()
        {
            var now     = SystemTime.Now().AddDays(-1);
            var storyId = Guid.NewGuid();

            Views.Add(new StoryView {
                StoryId = storyId, Timestamp = now.AddHours(1)
            });
            Views.Add(new StoryView {
                StoryId = storyId, Timestamp = now.AddHours(2)
            });
            Views.Add(new StoryView {
                StoryId = storyId, Timestamp = now.AddHours(3)
            });

            var result = _storyViewRepository.FindAfter(storyId, now);

            Assert.Equal(3, result.Count);
        }