Ejemplo n.º 1
0
        public static async Task ComicNameChangePersistsAfterUpdating(
            [ValueSource(nameof(EnumerateKnownComicTypes))] MockComic comic)
        {
            // Initial comic import
            ComicData savedComic = await comicUpdater.ImportComic(comic.State1.ArchiveUrl);

            database.Write(realm => savedComic.Name = "New Name");

            // Update comic now that selector has been switched
            IEnumerable <ComicPageData> pages = await comicUpdater.UpdateComic(savedComic);

            Assert.AreEqual("New Name", savedComic.Name);
        }
Ejemplo n.º 2
0
        public static async Task PageIsNewIsFalseWhenImported(
            [ValueSource(nameof(EnumerateKnownComicTypes))] MockComic comic)
        {
            ComicData savedComic = await comicUpdater.ImportComic(comic.State1.ArchiveUrl);

            Assert.Multiple(() =>
            {
                // No pages should be new since comic was just imported
                foreach (var page in savedComic.Pages)
                {
                    Assert.IsFalse(page.IsNew);
                }
            });
        }
Ejemplo n.º 3
0
        public static async Task PageIsNewIsTrueWhenUpdated(
            [ValueSource(nameof(EnumerateKnownComicTypes))] MockComic comic)
        {
            // Initial comic import
            ComicData savedComic = await comicUpdater.ImportComic(comic.State1.ArchiveUrl);

            // Switch selector to next stage
            pageLoader.StateSelector = c => c.State2;

            // Update comic now that selector has been switched
            IEnumerable <ComicPageData> pages = await comicUpdater.UpdateComic(savedComic);

            Assert.GreaterOrEqual(pages.Count(p => p.IsNew), 1);

            Assert.Fail();
        }
Ejemplo n.º 4
0
        public static async Task DiscoversPagesWorksForKnownTypesFromPageUrl(
            [ValueSource(nameof(EnumerateKnownComicTypes))] MockComic comic)
        {
            var pages = await comicUpdater.DiscoverPages(comic.State1.PageUrl);

            // Found expected amount of pages
            Assert.AreEqual(
                expected: comic.State1.PageCount,
                actual: pages.Count,
                message: "Wrong page count");

            // Known page was in page list
            Assert.AreEqual(
                expected: comic.State1.PageUrl,
                actual: pages[0].Url,
                message: "Found page URL wrong");
        }