public void Constructor_LoadsAllPages() { Directory.CreateDirectory(_dataDir); //arrange File.Create(Path.Combine(_dataDir, @"TestOne.wiki")); File.Create(Path.Combine(_dataDir, @"TestTwo.wiki")); //actual var sut = new WikidpadWiki(_testDir); var pageList = sut.GetAllPages(); //assert Assert.Equal("TestOne", pageList[0].Name); Assert.Equal("TestTwo", pageList[1].Name); }
public void GetPageContent_GetsContentAndMarksPageAsRead() { Directory.CreateDirectory(_dataDir); //arrange var expected = "+ Test One\n\n-This wiki file is generated by tests\n[tag:tests]"; var expected2 = "+ Test Two\n\n-This wiki file is generated by tests\n[tag:tests] CategoryTests"; File.WriteAllText(Path.Combine(_dataDir, "TestOne.wiki"), expected); File.WriteAllText(Path.Combine(_dataDir, "TestTwo.wiki"), expected2); //actual var sut = new WikidpadWiki(_testDir); var pageList = sut.GetAllPages(); //assert Assert.Equal(expected, pageList[0].GetPageContent()); Assert.Equal(expected2, pageList[1].GetPageContent()); Assert.True(pageList[0].ContentIsStale); Assert.True(pageList[1].ContentIsStale); }