コード例 #1
0
ファイル: ImageTests.cs プロジェクト: rhoadsce/Subtext
        public void CanGetRecentImages()
        {
            //arrange
            UnitTestHelper.SetupBlog();
            var repository = new DatabaseObjectProvider();
            var category = new LinkCategory
            {
                BlogId = Config.CurrentBlog.Id,
                Description = "Whatever",
                IsActive = true,
                Title = "Whatever"
            };
            int categoryId = repository.CreateLinkCategory(category);

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

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

            //assert
            Assert.AreEqual(1, images.Count);
            Assert.AreEqual(imageId, images.First().ImageID);
        }