Exemple #1
0
        public void CanUpdateStaticPage()
        {
            InMemoryRepo repo = new InMemoryRepo();
            var          page = new StaticPost();

            page = repo.GetStaticPost(2);

            page.Title   = "Our Story";
            page.Content = " <!DOCTYPE html><html><head><meta charset = 'UTF-8'><title>Our Story</title></head><body>Here's how we got started in this business!</body></html>";

            repo.UpdateStaticPost(page);

            var updatedPage = new StaticPost();

            updatedPage = repo.GetStaticPost(2);

            Assert.AreEqual("Our Story", updatedPage.Title);
            Assert.AreEqual(" <!DOCTYPE html><html><head><meta charset = 'UTF-8'><title>Our Story</title></head><body>Here's how we got started in this business!</body></html>", updatedPage.Content);
        }
Exemple #2
0
        public void CanDeleteStaticPage()
        {
            InMemoryRepo repo = new InMemoryRepo();
            var          page = new StaticPost();

            repo.DeleteStaticPost(3);

            page = repo.GetStaticPost(3);

            Assert.IsNull(page);
        }
Exemple #3
0
        public void CanLoadStaticPageById()
        {
            InMemoryRepo repo = new InMemoryRepo();
            var          page = new StaticPost();

            page = repo.GetStaticPost(1);

            Assert.IsNotNull(page);

            Assert.AreEqual(1, page.StaticPostId);
            Assert.AreEqual("Test Static Page", page.Title);
            Assert.AreEqual(" <!DOCTYPE html><html><head><meta charset = 'UTF-8'><title>Sample Static Title</title></head><body>This is the body of a sample static page.</body></html>", page.Content);
        }
Exemple #4
0
        public void CanAddStaticPage()
        {
            InMemoryRepo repo = new InMemoryRepo();
            var          page = new StaticPost
            {
                Title   = "Testimonials",
                Content = " <!DOCTYPE html><html><head><meta charset = 'UTF-8'><title>Testimonials</title></head><body>Listen to people who love our services.</body></html>",
            };

            repo.AddStaticPost(page);

            var pageList = repo.GetAllStaticPosts();

            Assert.AreEqual(4, pageList.Count());

            page = repo.GetStaticPost(4);

            Assert.AreEqual(4, page.StaticPostId);
            Assert.AreEqual("Testimonials", page.Title);
            Assert.AreEqual(" <!DOCTYPE html><html><head><meta charset = 'UTF-8'><title>Testimonials</title></head><body>Listen to people who love our services.</body></html>", page.Content);
        }