예제 #1
0
        public void CanGetImagesByCategoryId()
        {
            UnitTestHelper.SetupBlog();
            var repository = new DatabaseObjectProvider();
            int categoryId = UnitTestHelper.CreateCategory(Config.CurrentBlog.Id, "UnitTestImages",
                                                           CategoryType.ImageCollection);

            Assert.AreEqual(0, repository.GetImagesByCategory(categoryId, true).Count);

            Image image = CreateImageInstance(Config.CurrentBlog, categoryId);
            image.IsActive = true;

            int imageId = repository.Insert(image, singlePixelBytes);

            ImageCollection images = repository.GetImagesByCategory(categoryId, true);
            Assert.AreEqual(1, images.Count, "Expected to get our one image.");
            Assert.AreEqual(imageId, images[0].ImageID);
        }