public void E_DeleteAuthor()
        {
            IRepository<Author> authorRep = new AuthorRepository();

            Author author = authorRep.Read(2);
            authorRep.Delete(author);
        }
        public void D_ReadAllAuthors()
        {
            IRepository<Author> authorRep = new AuthorRepository();

            List<Author> authors = authorRep.ReadAll().ToList();
            Assert.AreEqual(2, authors.Count);
        }
        public void B_ReadAuthor()
        {
            IRepository<Author> authorRep = new AuthorRepository();

            Author author = authorRep.Read(1);
            Assert.IsNotNull(author);
        }
        public void A_CreateAuthor()
        {
            Author author = new Author("testname", "testName");

            IRepository<Author> authorRep = new AuthorRepository();
            authorRep.Create(author);
        }
        public void C_UpdateAuthor()
        {
            A_CreateAuthor();

            IRepository<Author> authorRep = new AuthorRepository();

            Author author = authorRep.Read(2);
            author.FirstName = "updatedName";
            authorRep.Update(author);

            Assert.AreEqual("updatedName", authorRep.Read(2).FirstName);
        }
        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);
        }