public void VerifyRepoSavesComicTitles()
        {
            // Setup
            ComicRepository   cr        = new ComicRepository();
            List <ComicTitle> comicList = new List <ComicTitle>();

            cr.DeleteAllSubscriptions();

            // Arrange
            for (var i = 0; i < 5; i++)
            {
                comicList.Add(new ComicTitle
                {
                    Name    = "TestTitle" + i,
                    Url     = "TestUrl" + i,
                    IconUrl = "TestIconUrl" + i
                });
            }

            // Act
            cr.SaveSubscription(comicList[0]);
            List <ComicTitle> comicTitlesFromStorage = cr.GetSubscriptionList();

            // Assert
            Assert.AreEqual(comicList[0].Name, comicTitlesFromStorage[0].Name);
        }
Exemplo n.º 2
0
        void OnUnsubbedComicTapped(object sender, ItemTappedEventArgs e)
        {
            var             comicTitle = e.Item as ComicTitle;
            ComicRepository cr         = new ComicRepository();

            cr.SaveSubscription(comicTitle);
            UpdateDataBinding();

            Device.BeginInvokeOnMainThread(() =>
            {
                DisplayAlert("Success", $"{comicTitle.Name} has been added!", "OK");
            });
        }