public void Update_DoNotSendNotificationsForReprints()
        {
            song.PVs.PVs.Clear();
            song.CreateDate = DateTime.Now - TimeSpan.FromDays(30);
            repository.Save(user2.AddArtist(producer));
            var contract = EditContract();

            contract.PVs = new[] { CreateEntry.PVContract(pvType: PVType.Reprint) };

            queries.UpdateBasicProperties(contract);

            Assert.AreEqual(0, repository.Count <UserMessage>(), "No notification was sent");
        }
Exemple #2
0
        public async Task Update_DoNotSendNotificationsForReprints()
        {
            _song.PVs.PVs.Clear();
            _song.CreateDate = DateTime.Now - TimeSpan.FromDays(30);
            _repository.Save(_user2.AddArtist(_producer));
            var contract = EditContract();

            contract.PVs = new[] { CreateEntry.PVContract(pvType: PVType.Reprint) };

            await _queries.UpdateBasicProperties(contract);

            _repository.Count <UserMessage>().Should().Be(0, "No notification was sent");
        }
        public void Update_PublishDate_From_PVs()
        {
            var contract = new SongForEditContract(song, ContentLanguagePreference.English);

            contract.PVs = new[] {
                CreateEntry.PVContract(id: 1, pvId: "hoLu7c2XZYU", pvType: PVType.Reprint, publishDate: new DateTime(2015, 3, 9, 10, 0, 0)),
                CreateEntry.PVContract(id: 2, pvId: "mikumikumiku", pvType: PVType.Original, publishDate: new DateTime(2015, 4, 9, 16, 0, 0))
            };

            contract = queries.UpdateBasicProperties(contract);

            var songFromRepo = repository.Load(contract.Id);

            Assert.AreEqual(2, songFromRepo.PVs.PVs.Count, "Number of PVs");
            Assert.AreEqual(new DateTime(2015, 4, 9), songFromRepo.PublishDate.DateTime, "Song publish date was updated");
        }
Exemple #4
0
        public async Task Update_PublishDate_From_PVs()
        {
            var contract = new SongForEditContract(_song, ContentLanguagePreference.English);

            contract.PVs = new[] {
                CreateEntry.PVContract(id: 1, pvId: "hoLu7c2XZYU", pvType: PVType.Reprint, publishDate: new DateTime(2015, 3, 9, 10, 0, 0)),
                CreateEntry.PVContract(id: 2, pvId: "mikumikumiku", pvType: PVType.Original, publishDate: new DateTime(2015, 4, 9, 16, 0, 0))
            };

            contract = await _queries.UpdateBasicProperties(contract);

            var songFromRepo = _repository.Load(contract.Id);

            songFromRepo.PVs.PVs.Count.Should().Be(2, "Number of PVs");
            songFromRepo.PublishDate.DateTime.Should().Be(new DateTime(2015, 4, 9), "Song publish date was updated");
        }
        public void Update_SendNotificationsForNewPVs()
        {
            song.PVs.PVs.Clear();
            song.CreateDate = DateTime.Now - TimeSpan.FromDays(30);
            repository.Save(user2.AddArtist(producer));
            var contract = EditContract();

            contract.PVs = new[] { CreateEntry.PVContract(pvType: PVType.Original) };

            queries.UpdateBasicProperties(contract);

            var notifications = repository.List <UserMessage>();

            Assert.AreEqual(1, notifications.Count, "Notification was sent");
            var notification = notifications.First();

            Assert.AreEqual(user2, notification.User, "Notification was sent to user");
        }
Exemple #6
0
        public async Task Update_SendNotificationsForNewPVs()
        {
            _song.PVs.PVs.Clear();
            _song.CreateDate = DateTime.Now - TimeSpan.FromDays(30);
            _repository.Save(_user2.AddArtist(_producer));
            var contract = EditContract();

            contract.PVs = new[] { CreateEntry.PVContract(pvType: PVType.Original) };

            await _queries.UpdateBasicProperties(contract);

            var notifications = _repository.List <UserMessage>();

            notifications.Count.Should().Be(1, "Notification was sent");
            var notification = notifications.First();

            notification.User.Should().Be(_user2, "Notification was sent to user");
        }