Exemplo n.º 1
0
        public void CanParseRssFeed(string feed)
        {
            using (var context = new BlogifierDbContext(_options))
            {
                var storage = new BlogStorage("test");
                var path = Path.Combine(GetRoot(), feed);

                var uow = new UnitOfWork(context);

                var profile = uow.Profiles.Single(p => p.IdentityName == "test");

                if(profile == null)
                {
                    profile = new Profile();
                    profile.IdentityName = "test";
                    profile.AuthorName = "test";
                    profile.AuthorEmail = "*****@*****.**";
                    profile.Title = "test";
                    profile.Slug = "test";
                    profile.Description = "the test";
                    profile.BlogTheme = "Standard";

                    uow.Profiles.Add(profile);
                    uow.Complete();
                }

                Assert.True(context.Profiles.ToList().Count > 0);

                var service = new RssService(uow, null);

                var model = new RssImportModel();
                model.FeedUrl = path;
                model.ProfileId = profile.Id;

                var result = service.Import(model);

                Assert.True(context.BlogPosts.ToList().Count > 1);
            }

            Assert.NotNull(feed);
        }