예제 #1
0
        public void FindById_Should_Return_Correct_MarkAsSpam()
        {
            MarkAsSpams.Add(new StoryMarkAsSpam {
                StoryId = Guid.NewGuid(), UserId = Guid.NewGuid()
            });

            var storyId = MarkAsSpams[0].StoryId;
            var userId  = MarkAsSpams[0].UserId;

            Assert.NotNull(_markAsSpamRepository.FindById(storyId, userId));
        }
예제 #2
0
        public void CountByStory_Should_Return_Correct_Count()
        {
            var storyId = Guid.NewGuid();

            MarkAsSpams.Add(new StoryMarkAsSpam {
                StoryId = storyId
            });
            MarkAsSpams.Add(new StoryMarkAsSpam {
                StoryId = storyId
            });
            MarkAsSpams.Add(new StoryMarkAsSpam {
                StoryId = storyId
            });

            Assert.Equal(3, _markAsSpamRepository.CountByStory(storyId));
        }
예제 #3
0
        public void FindAfter_Should_Return_Correct_MarkAsSpams()
        {
            var now     = SystemTime.Now().AddDays(-1);
            var storyId = Guid.NewGuid();

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

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

            Assert.Equal(3, result.Count);
        }
예제 #4
0
        public void FindIPAddresses_Should_Return_The_IPAddresses_That_The_User_Used_To_Submit_Comment_Promote_And_MarkAsSpams()
        {
            var id = Guid.NewGuid();

            Stories.Add(new Story {
                Id = Guid.NewGuid(), UserId = id, IPAddress = "192.168.0.1"
            });
            Comments.Add(new StoryComment {
                Id = Guid.NewGuid(), UserId = id, IPAddress = "192.168.0.2", StoryId = Stories[0].Id
            });
            Votes.Add(new StoryVote {
                UserId = id, IPAddress = "192.168.0.1", StoryId = Stories[0].Id
            });
            MarkAsSpams.Add(new StoryMarkAsSpam {
                UserId = id, IPAddress = "192.168.0.3"
            });

            var ipAddresses = _userRepository.FindIPAddresses(id);

            Assert.Equal(3, ipAddresses.Count);
        }
        public void FindIPAddresses_Should_Return_The_IPAddresses_That_The_User_Used_To_Submit_Comment_Promote_And_MarkAsSpams()
        {
            //var id = Guid.NewGuid();

            var user = (User)_factory.CreateUser("dummyuser", "*****@*****.**", String.Empty);

            Stories.Add(new Story {
                Id = Guid.NewGuid(), User = user, IpAddress = "192.168.0.1"
            });
            Comments.Add(new StoryComment {
                Id = Guid.NewGuid(), User = user, IpAddress = "192.168.0.2", Story = Stories[0]
            });
            Votes.Add(new StoryVote {
                UserId = user.Id, IpAddress = "192.168.0.1", StoryId = Stories[0].Id
            });
            MarkAsSpams.Add(new StoryMarkAsSpam {
                UserId = user.Id, IpAddress = "192.168.0.3"
            });

            var ipAddresses = _userRepository.FindIPAddresses(user.Id);

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