public void Validate(Author author)
 {
     if (author.Age < 0)
     {
         throw new ValidationException("Invalid age!");
     }
 }
        public void ValidateTest()
        {
            Author author = new Author("ad",-1);
            try
            {
                validator.Validate(author);
                Assert.AreEqual(1, 2);
            }
            catch (Exception)
            {
                Assert.AreEqual(1, 1);
            }

            author.Age = 45;

            try
            {
                validator.Validate(author);
                Assert.AreEqual(1,1);
            }
            catch (Exception)
            {
                Assert.AreEqual(1,2);
            }
        }
        public void AuthorTest()
        {
            Author author = new Author("name", 21);

            //testing the constructor
            Assert.AreEqual("name", author.Name);
            Assert.AreEqual(21, author.Age);

            //testing get and set for id
            author.Id = 1;
            Assert.AreEqual(1, author.Id);

            //testing get and set for name
            author.Name = "test";
            Assert.AreEqual("test", author.Name);

            //testing get and set for age
            author.Age = 1;
            Assert.AreEqual(1, author.Age);
        }
 public void Save(Author author)
 {
     _authorGenericRepository.Save(author);
 }