コード例 #1
0
        public void ExportWholeStory()
        {
            var storyLoader = new XmlStoryFileStore();
            var story       = storyLoader.DeserializeStory(TestUtil.GetDataFile(@"SampleStories.1824771-short-stories-by-the-people.xml"));

            var exporter = new WdcStoryExporterHtmlCollection("StoryOutput");

            exporter.ExportStory(story);
        }
コード例 #2
0
        public async Task WdcReaderInteractiveStoryTitle()
        {
            WdcResponse payload = new WdcResponse();

            payload.WebResponse = TestUtil.GetDataFile("sample_set_13_06_2019.Looking for adventure - homepage - logged in.html");

            var result = _reader.GetInteractiveStoryTitle(payload);

            Assert.AreEqual("Looking for adventure", result);
        }
コード例 #3
0
        public async Task WdcReaderInteractiveStoryShortDescription()
        {
            WdcResponse payload = new WdcResponse();

            payload.WebResponse = TestUtil.GetDataFile("sample_set_13_06_2019.Looking for adventure - homepage - logged in.html");

            var result = _reader.GetInteractiveStoryShortDescription(payload);

            Assert.AreEqual("Four people looking for adventure, and dealing with past demons", result);
        }
コード例 #4
0
        public async Task WdcReaderInteractiveChapterFirstPageLoggedIn()
        {
            // Expected results
            var expectedChapter = new WdcInteractiveChapter();

            expectedChapter.Path              = "1";
            expectedChapter.Title             = "The Great War";
            expectedChapter.SourceChoiceTitle = string.Empty;
            expectedChapter.Content           = TestUtil.GetDataFile("expected_set_13_06_2019.WdcReaderInteractiveChapter1_Content.txt");
            expectedChapter.IsEnd             = false;
            expectedChapter.Author            = new WdcAuthor()
            {
                Name     = "The Nameless Hermit",
                Username = "******",
            };
            expectedChapter.Choices.Add(new WdcInteractiveChapterChoice()
            {
                PathLink = "11", Name = "Be Jace"
            });
            expectedChapter.Choices.Add(new WdcInteractiveChapterChoice()
            {
                PathLink = "12", Name = "Be Rhea"
            });
            expectedChapter.Choices.Add(new WdcInteractiveChapterChoice()
            {
                PathLink = "13", Name = "Be Marek"
            });
            expectedChapter.Choices.Add(new WdcInteractiveChapterChoice()
            {
                PathLink = "14", Name = "Be Tara"
            });

            WdcResponse payload = new WdcResponse();

            payload.WebResponse = TestUtil.GetDataFile("sample_set_13_06_2019.Looking for adventure - chapter 1 - logged in.html");
            payload.Address     = "https://www.writing.com/main/interact/item_id/209084-Looking-for-adventure/map/1";

            WdcInteractiveChapter testChapter = _reader.GetInteractiveChaper("TEST", expectedChapter.Path, payload);



            // Tests
            //Assert.AreEqual(expectedChapterTitle, chapterResult.Title);
            //Assert.AreEqual(expectedChapterSourceTitle, chapterResult.SourceChoiceTitle);
            //Assert.AreEqual(expectedChapterContent, chapterResult.Content);
            //Assert.AreEqual(expectedIsEnd, chapterResult.IsEnd);
            //Assert.AreEqual(expectedAuthorName, chapterResult.Author.Name);
            //Assert.AreEqual(expectedAuthorUsername, chapterResult.Author.Username);
            //for (var i=0; i < chapterResult.Choices.Count; i++)
            //{
            //    Assert.AreEqual(expectedChoices[i].Name, chapterResult.Choices[i].Name, "Chapter choice name doesn't match");
            //    Assert.AreEqual(expectedChoices[i].PathLink, chapterResult.Choices[i].PathLink, "Chapter choice path doesn't match");
            //}
            CompareInteractiveChapters(expectedChapter, testChapter);
        }
コード例 #5
0
        public async Task WdcReaderInteractiveStoryDescription()
        {
            WdcResponse payload = new WdcResponse();

            payload.WebResponse = TestUtil.GetDataFile("sample_set_13_06_2019.Looking for adventure - homepage - logged in.html");

            var result   = _reader.GetInteractiveStoryDescription(payload);
            var expected = TestUtil.GetDataFile("expected_set_13_06_2019.WdcReaderInteractiveStoryDescription-ExpectedResult_13_06_2019.txt");

            Assert.AreEqual(expected, result);
        }
コード例 #6
0
        public async Task WdcReaderInteractiveStoryAuthor()
        {
            WdcResponse payload = new WdcResponse();

            payload.WebResponse = TestUtil.GetDataFile("sample_set_13_06_2019.Looking for adventure - homepage - logged in.html");

            WdcAuthor result = _reader.GetInteractiveStoryAuthor(payload);

            Assert.AreEqual("The Nameless hermit", result.Name, "The author's name is not what was expected");
            Assert.AreEqual("blackdragon", result.Username, "The author's username is not what was expected");
        }
コード例 #7
0
        private string GetPage(string fname)
        {
            //lock (_lock)
            //{
            //    var fPath = Path.Combine(_dataDir, fname);
            //    // If we've seent his file before, just return it
            //    if (_payloadCache.ContainsKey(fPath)) return _payloadCache[fPath];

            //    return File.ReadAllText(fPath);
            //}

            return(TestUtil.GetDataFile(Path.Combine(_dataDir, fname)));
        }
コード例 #8
0
        public async Task WdcReaderInteractiveChapterFirstPageLoggedOut()
        {
            // Expected results
            var expectedChapter = new WdcInteractiveChapter();

            expectedChapter.Path              = "1";
            expectedChapter.Title             = "The Great War";
            expectedChapter.SourceChoiceTitle = string.Empty;
            expectedChapter.Content           = TestUtil.GetDataFile("expected_set_13_06_2019.WdcReaderInteractiveChapter1_Content.txt");
            expectedChapter.IsEnd             = false;
            expectedChapter.Author            = new WdcAuthor()
            {
                Name     = "The Nameless Hermit",
                Username = "******",
            };
            expectedChapter.Choices.Add(new WdcInteractiveChapterChoice()
            {
                PathLink = "11", Name = "Be Jace"
            });
            expectedChapter.Choices.Add(new WdcInteractiveChapterChoice()
            {
                PathLink = "12", Name = "Be Rhea"
            });
            expectedChapter.Choices.Add(new WdcInteractiveChapterChoice()
            {
                PathLink = "13", Name = "Be Marek"
            });
            expectedChapter.Choices.Add(new WdcInteractiveChapterChoice()
            {
                PathLink = "14", Name = "Be Tara"
            });

            // Set things up
            WdcResponse payload = new WdcResponse();

            payload.WebResponse = TestUtil.GetDataFile("sample_set_13_06_2019.Looking for adventure - chapter 1 - logged out.html");
            payload.Address     = "https://www.writing.com/main/interact/item_id/209084-Looking-for-adventure/map/1";

            WdcInteractiveChapter testChapter = _reader.GetInteractiveChaper("TEST", expectedChapter.Path, payload);

            // Compare
            CompareInteractiveChapters(expectedChapter, testChapter);
        }