public void CreateReport_Version() { var version = ArchivedSongVersion.Create(song, new SongDiff(), new AgentLoginData(user), SongArchiveReason.PropertiesUpdated, String.Empty); repository.Save(version); CallCreateReport(SongReportType.Other, version.Version); var report = repository.List <SongReport>().First(); Assert.AreEqual(version.Version, report.VersionNumber, "Version number"); Assert.IsNotNull(report.VersionBase, "VersionBase"); var notification = repository.List <UserMessage>().FirstOrDefault(); Assert.IsNotNull(notification, "Notification was created"); Assert.AreEqual(user, notification.Receiver, "Notification receiver"); Assert.AreEqual(string.Format(EntryReportStrings.EntryVersionReportTitle, song.DefaultName), notification.Subject, "Notification subject"); Assert.AreEqual(string.Format(EntryReportStrings.EntryVersionReportBody, MarkdownHelper.CreateMarkdownLink(entryLinkFactory.GetFullEntryUrl(song), song.DefaultName), "It's Miku, not Rin"), notification.Message, "Notification message"); }
public async Task CreateReport_Version() { var version = ArchivedSongVersion.Create(_song, new SongDiff(), new AgentLoginData(_user), SongArchiveReason.PropertiesUpdated, String.Empty); _repository.Save(version); await CallCreateReport(SongReportType.Other, version.Version); var report = _repository.List <SongReport>().First(); report.VersionNumber.Should().Be(version.Version, "Version number"); report.VersionBase.Should().NotBeNull("VersionBase"); var notification = _repository.List <UserMessage>().FirstOrDefault(); notification.Should().NotBeNull("Notification was created"); notification.Receiver.Should().Be(_user, "Notification receiver"); notification.Subject.Should().Be(string.Format(EntryReportStrings.EntryVersionReportTitle, _song.DefaultName), "Notification subject"); notification.Message.Should().Be(string.Format(EntryReportStrings.EntryVersionReportBody, MarkdownHelper.CreateMarkdownLink(_entryLinkFactory.GetFullEntryUrl(_song), _song.DefaultName), "It's Miku, not Rin"), "Notification message"); }