public void TestSerializeAndStoreBrowser() { // Arrange MiniBowser.MiniBowser mb = new MiniBowser.MiniBowser(); // History mb.History.AddNewSite("https://www.hw.ac.uk/"); mb.History.AddNewSite("https://www.vision.hw.ac.uk/"); mb.History.AddNewSite("https://www.outlook.com/"); // Bookmarks Bookmark bm1 = new Bookmark("Google", "http://www.google.com/"); Bookmark bm2 = new Bookmark("HWU", "http://www.hw.ac.uk/"); Bookmark bm3 = new Bookmark("Vision", "http://www.vision.hw.ac.uk/"); Bookmark bm4 = new Bookmark("Mail", "http://www.outlook.com/"); mb.AddBookmark(bm1); mb.AddBookmark(bm2); mb.AddBookmark(bm3); mb.AddBookmark(bm4); // homepage mb.Homepage = "https://www.google.com/"; // Act serializer.SerializeAndStoreBrowser(mb); string actualHistory = File.ReadAllText(Serializer.pathHistory); string actualBookmarks = File.ReadAllText(Serializer.pathBookmarks); // Assert Assert.AreEqual(expectedBookmarks, actualBookmarks); Assert.AreEqual(expectedHistory, actualHistory); Assert.AreEqual("\"https://www.google.com/\"", System.IO.File.ReadAllText(Serializer.pathHomepage)); }
public void TestAddBookmark() { // Arrange Bookmark bm = new Bookmark("Google", "http://www.google.com"); MiniBowser.MiniBowser mb = new MiniBowser.MiniBowser(); // Act mb.AddBookmark(bm); // Assert Assert.IsTrue(mb.BookmarkList.Contains(bm)); }