public void UnPushPin_WhenCalled_RemovesFromPinnedList() { var recentEntries = new RecentEntryList(); var localSettingsMock = Mock.Create<ILocalSettingsService>(); Mock.Arrange(() => localSettingsMock.SaveRecentEntries(Arg.IsAny<string>(), Arg.IsAny<string>())); recentEntries.LocalSettingsService = localSettingsMock; recentEntries.Add(5, "test", "description"); recentEntries.PushPin(new RecentEntry(5, "test", "description", recentEntries)); Assert.AreEqual(recentEntries.PinnedList.Count, 1); recentEntries.UnPushPin(new RecentEntry(5, "Whatever", "description", recentEntries)); Assert.AreEqual(recentEntries.PinnedList.Count, 0); }
public void UnPushPin_WhenCalled_CallsSave() { var recentEntries = new RecentEntryList(); var localSettingsMock = Mock.Create<ILocalSettingsService>(); var calls = 0; Mock.Arrange(() => localSettingsMock.SaveRecentEntries(Arg.IsAny<string>(), Arg.IsAny<string>())).DoInstead(() => calls++); recentEntries.LocalSettingsService = localSettingsMock; recentEntries.Add(5, "description", "test"); recentEntries.PushPin(new RecentEntry(5, "test", "description", recentEntries)); recentEntries.UnPushPin(new RecentEntry(5, "ddd", "description", recentEntries)); Assert.AreEqual(3, calls); }