public void E_DeleteCategory()
        {
            IRepository<Category> categoryRep = new CategoryRepository();

            Category category = categoryRep.Read(2);
            categoryRep.Delete(category);
        }
        public void D_ReadAllCategories()
        {
            IRepository<Category> categoryRep = new CategoryRepository();

            List<Category> categories = categoryRep.ReadAll().ToList();
            Assert.AreEqual(2, categories.Count);
        }
        public void B_ReadCategory()
        {
            IRepository<Category> categoryRep = new CategoryRepository();

            Category category = categoryRep.Read(1);
            Assert.IsNotNull(category);
        }
        public void A_CreateCategory()
        {
            Category category = new Category("testName");

            IRepository<Category> categoryRep = new CategoryRepository();
            categoryRep.Create(category);
        }
        public void C_UpdateCategory()
        {
            A_CreateCategory();

            IRepository<Category> categoryRep = new CategoryRepository();

            Category category = categoryRep.Read(2);
            category.Name = "updatedName";
            categoryRep.Update(category);

            Assert.AreEqual("updatedName", categoryRep.Read(2).Name);
        }
        public void A_CreateArticle()
        {
            IRepository<Category> categoryRep = new CategoryRepository();
            Category category = categoryRep.Read(1);

            IRepository<Author> authorRep = new AuthorRepository();
            Author author = authorRep.Read(1);

            #region Read photo from file

            FileInfo fileInfo = new FileInfo(@"..\..\..\..\..\DAL\Resources\Chrysanthemum.jpg");
            FileStream fileStream = fileInfo.OpenRead();
            long length = fileStream.Length;

            byte[] photoData = null;

            if (length > 0)
            {
                photoData = new byte[length];
            }

            fileStream.Read(photoData, 0, Convert.ToInt32(length));
            fileStream.Close();

            #endregion

            Photo photo1 = new Photo(PhotoType.Large, "testName", photoData);
            Photo photo2 = new Photo(PhotoType.Medium, "testName", photoData);
            Photo photo3 = new Photo(PhotoType.Small, "testName", photoData);
            List<Photo> photos = new List<Photo>();
            photos.Add(photo1);
            photos.Add(photo2);
            photos.Add(photo3);

            Article article = new Article("testName", "testName", "testName", "testName", "testName", "testName", "testName", true, true, true, category, author, photos);

            IRepository<Article> articleRep = new ArticleRepository();
            articleRep.Create(article);
        }