Exemple #1
0
        public void CanANewContentBeCreated()
        {
            Content a = new Content()
            {
                contentid   = 99,
                headerimage = "Some image from test",
                tabimage    = "Some Name from test",
                slug        = "new-post-from-test",
                body        = "some awesome tesx",
                title       = "some title added from test",
                authorid    = 1,
            };

            _testRepo.Add(a);

            var insertedContent = _testRepo.FindAll().Where(w => w.slug == a.slug).First();

            _testid = insertedContent.contentid;
            Assert.AreEqual(a.slug, insertedContent.slug);
        }
Exemple #2
0
        public static void ClassStart(TestContext context)
        {
            var         config = GeneralHelpers.InitConfiguration();
            ContentRepo a      = new ContentRepo(config);

            _testRepo = a;

            var insert_value = a.FindAll().Where(w => w.slug == "new-post-from-test");

            if (insert_value.Count() > 0)
            {
                var id = insert_value.Where(w => w.slug == "new-post-from-test").First().contentid;

                a.Remove(id);
            }

            Content con = new Content()
            {
                contentid    = 6,
                headerimage  = "Some image from test _ updated",
                tabimage     = "Some Name from test _ updated",
                slug         = "new-post-from-test _ updated",
                body         = "some awesome tesx _ updated",
                title        = "some title added from test _ updated",
                authorid     = 1,
                views        = 1,
                stars        = (float)4.5,
                published    = true,
                staged       = true,
                draft        = true,
                created_on   = DateTime.Now,
                published_on = DateTime.Now
            };

            _testRepo.Update(con);
        }
 public IActionResult GetContent()
 {
     _log.LogInformation(ContentRepo.getConnectionString());
     return(Ok(ContentRepo.FindAll()));
 }