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); }
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); }
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); }
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); }
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); }
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"); }
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))); }
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); }