예제 #1
0
        public void CanGetRecentImages()
        {
            //arrange
            UnitTestHelper.SetupBlog();
            ObjectProvider provider = ObjectProvider.Instance();
            var            category = new LinkCategory
            {
                BlogId      = Config.CurrentBlog.Id,
                Description = "Whatever",
                IsActive    = true,
                Title       = "Whatever"
            };
            int categoryId = provider.CreateLinkCategory(category);

            var image = new Image
            {
                Title      = "Title",
                CategoryID = categoryId,
                BlogId     = Config.CurrentBlog.Id,
                FileName   = "Foo",
                Height     = 10,
                Width      = 10,
                IsActive   = true,
            };
            int imageId = provider.InsertImage(image);

            //act
            ICollection <Image> images = provider.GetImages(Config.CurrentBlog.Host, null, 10);

            //assert
            Assert.AreEqual(1, images.Count);
            Assert.AreEqual(imageId, images.First().ImageID);
        }
예제 #2
0
 private static void CreateWelcomeCategories(ObjectProvider repository, Blog blog)
 {
     repository.CreateLinkCategory(new LinkCategory
     {
         Title        = "Programming",
         Description  = "Blog posts related to programming",
         BlogId       = blog.Id,
         IsActive     = true,
         CategoryType = CategoryType.PostCollection,
     });
     repository.CreateLinkCategory(new LinkCategory
     {
         Title        = "Personal",
         Description  = "Personal musings, random thoughts.",
         BlogId       = blog.Id,
         IsActive     = true,
         CategoryType = CategoryType.PostCollection
     });
 }