Beispiel #1
0
        public void UpdateSongRating_Create()
        {
            var song = _repository.Save(CreateEntry.Song());

            _service.UpdateSongRating(_user.Id, song.Id, SongVoteRating.Favorite);

            _user.FavoriteSongs.Any(s => s.Song == song).Should().BeTrue("Song was added to user");
            _user.FavoriteSongs.Count.Should().Be(1, "Number of favorite songs for user");
            _repository.List <FavoriteSongForUser>().Count.Should().Be(1, "Number of links in repo");
        }
        public void UpdateSongRating_Create()
        {
            var song = repository.Save(CreateEntry.Song());

            service.UpdateSongRating(user.Id, song.Id, SongVoteRating.Favorite);

            Assert.IsTrue(user.FavoriteSongs.Any(s => s.Song == song), "Song was added to user");
            Assert.AreEqual(1, user.FavoriteSongs.Count, "Number of favorite songs for user");
            Assert.AreEqual(1, repository.List <FavoriteSongForUser>().Count, "Number of links in repo");
        }
Beispiel #3
0
        public void CheckComment_Mentioned()
        {
            CheckComment("Hello world, @miku");

            var notification = repository.List <UserMessage>().FirstOrDefault();

            Assert.IsNotNull(notification, "Notification was created");
            Assert.IsNull(notification.Sender, "Sender");
            Assert.AreEqual(user.Id, notification.Receiver.Id, "Receiver Id");
            Assert.AreEqual("Mentioned in a comment", notification.Subject, "Subject");
        }
Beispiel #4
0
        public void CheckComment_Mentioned()
        {
            CheckComment("Hello world, @miku");

            var notification = _repository.List <UserMessage>().FirstOrDefault();

            notification.Should().NotBeNull("Notification was created");
            notification.Sender.Should().BeNull("Sender");
            notification.Receiver.Id.Should().Be(_user.Id, "Receiver Id");
            notification.Subject.Should().Be("Mentioned in a comment", "Subject");
        }
Beispiel #5
0
        public void AddNewTagByName()
        {
            var tags = new[] { Contract("vocarock") };

            AddTags(entry.Id, tags);

            Assert.AreEqual(1, entry.Tags.Tags.Count(), "Number of tags");
            var usage = entry.Tags.Usages.First();

            Assert.AreEqual("vocarock", usage.Tag.DefaultName, "Added tag name");
            Assert.IsTrue(usage.HasVoteByUser(user), "Vote is by the logged in user");
            Assert.AreEqual(1, usage.Tag.UsageCount, "Number of usages for tag");

            Assert.AreEqual(2, repository.List <Tag>().Count, "Number of tags in the repository");
            Assert.IsTrue(repository.List <Tag>().Contains(usage.Tag), "Tag in repository is the same as the one applied");
        }
Beispiel #6
0
 private User GetUserFromRepo(string username)
 {
     return(repository.List <User>().FirstOrDefault(u => u.Name == username));
 }