public void Read_WhenCalledWithEmptyXml_LeavesListsEmpty() { var recentEntries = new RecentEntryList(); var localSettingsMock = Mock.Create<ILocalSettingsService>(); Mock.Arrange(() => localSettingsMock.ReadRecentEntries(Arg.IsAny<string>())).Returns(@""); recentEntries.LocalSettingsService = localSettingsMock; recentEntries.Read(); Assert.AreEqual(0, recentEntries.PinnedList.Count); Assert.AreEqual(0, recentEntries.UnpinnedList.Count); }
public void Read_WhenCalled_FillUnPinnedAndPinnedList() { var recentEntries = new RecentEntryList(); var localSettingsMock = Mock.Create<ILocalSettingsService>(); Mock.Arrange(() => localSettingsMock.ReadRecentEntries(Arg.IsAny<string>())) .Returns(@"<Entries><pinned><entry id=""1"" name=""test""></entry></pinned><unpinned><entry id=""1"" name=""test""></entry></unpinned></Entries>"); recentEntries.LocalSettingsService = localSettingsMock; recentEntries.Read(); Assert.AreEqual(1, recentEntries.PinnedList.Count); Assert.AreEqual(1, recentEntries.UnpinnedList.Count); }