public void DependencyInjectionTest()
        {
            //Checking DataFiller property is null
            _dataLayer = new LibraryRepository();
            Assert.AreEqual(_dataLayer.DataFiller, null);
            _dataLayer.FillData();
            Assert.AreEqual(0, _dataLayer.GetAllAuthors().Count());
            Assert.AreEqual(0, _dataLayer.GetAllBooks().Count());
            Assert.AreEqual(0, _dataLayer.GetAllReaders().Count());
            Assert.AreEqual(0, _dataLayer.GetAllEmployees().Count());
            Assert.AreEqual(0, _dataLayer.GetAllCopiesOfBook().Count());
            Assert.AreEqual(0, _dataLayer.GetAllEvents().Count());
            //Inject IDataFiller impelentation (Fill with Consts)
            ConstObjectsFiller cof = new ConstObjectsFiller();

            _dataLayer.DataFiller = cof;
            _dataLayer.FillData();
            Assert.AreEqual(2, _dataLayer.GetAllAuthors().Count());
            Assert.AreEqual(3, _dataLayer.GetAllBooks().Count());
            Assert.AreEqual(1, _dataLayer.GetAllReaders().Count());
            Assert.AreEqual(1, _dataLayer.GetAllEmployees().Count());
            Assert.AreEqual(5, _dataLayer.GetAllCopiesOfBook().Count());
            Assert.AreEqual(1, _dataLayer.GetAllEvents().Count());
            //Inject IDatafiller implementation (Fill from Xml)
            XmlFileFiller xml = new XmlFileFiller();

            _dataLayer            = new LibraryRepository();
            _dataLayer.DataFiller = xml;
            _dataLayer.FillData();
            Assert.AreEqual(2, _dataLayer.GetAllAuthors().Count());
            Assert.AreEqual(1, _dataLayer.GetAllBooks().Count());
            Assert.AreEqual(1, _dataLayer.GetAllReaders().Count());
            Assert.AreEqual(1, _dataLayer.GetAllEmployees().Count());
            Assert.AreEqual(1, _dataLayer.GetAllCopiesOfBook().Count());
            Assert.AreEqual(1, _dataLayer.GetAllEvents().Count());
            TxtFileFiller txt = new TxtFileFiller();

            _dataLayer            = new LibraryRepository();
            _dataLayer.DataFiller = txt;
            _dataLayer.FillData();
            Assert.AreEqual(2, _dataLayer.GetAllAuthors().Count());
            Assert.AreEqual(1, _dataLayer.GetAllBooks().Count());
            Assert.AreEqual(1, _dataLayer.GetAllReaders().Count());
            Assert.AreEqual(1, _dataLayer.GetAllEmployees().Count());
            Assert.AreEqual(1, _dataLayer.GetAllCopiesOfBook().Count());
            Assert.AreEqual(1, _dataLayer.GetAllEvents().Count());
        }
        public void UpdateCopyOfBookTest()
        {
            ConstObjectsFiller cof = new ConstObjectsFiller();

            _dataLayer            = new LibraryRepository();
            _dataLayer.DataFiller = cof;
            _dataLayer.FillData();
            CopyOfBook newBook = new CopyOfBook(Guid.NewGuid(), _dataLayer.GetAllBooks().ElementAt(0), DateTime.Now, 21);
            Guid       id      = _dataLayer.GetAllCopiesOfBook().ElementAt(0).Id;

            Assert.ThrowsException <ArgumentException>(() => _dataLayer.UpdateCopyOfBook(id, newBook));
            Assert.ThrowsException <ArgumentException>(() => _dataLayer.UpdateCopyOfBook(Guid.NewGuid(), newBook));
            newBook = new CopyOfBook(id, _dataLayer.GetAllBooks().ElementAt(0), DateTime.Now, 21);
            _dataLayer.UpdateCopyOfBook(id, newBook);
            Assert.AreEqual(_dataLayer.GetCopyOfBook(id).PricePerDay, newBook.PricePerDay);
        }
        public void UpdateReaderTest()
        {
            ConstObjectsFiller cof = new ConstObjectsFiller();

            _dataLayer            = new LibraryRepository();
            _dataLayer.DataFiller = cof;
            _dataLayer.FillData();
            Reader newReader = new Reader(Guid.NewGuid(), "Andrzej", "Go�ota", new DateTime(1973, 10, 10), "987654321", "*****@*****.**", Person.Gender.Male, DateTime.Now);
            Guid   id        = _dataLayer.GetAllReaders().ElementAt(0).Id;

            Assert.ThrowsException <ArgumentException>(() => _dataLayer.UpdateReader(id, newReader));
            Assert.ThrowsException <ArgumentException>(() => _dataLayer.UpdateReader(Guid.NewGuid(), newReader));
            newReader = new Reader(id, "Andrzej", "Go�ota", new DateTime(1973, 10, 10), "987654321", "*****@*****.**", Person.Gender.Male, DateTime.Now);
            _dataLayer.UpdateReader(id, newReader);
            Assert.AreEqual(newReader.Email, _dataLayer.GetReader(id).Email);
            Assert.AreEqual(newReader.Name, _dataLayer.GetReader(id).Name);
        }
        public void UpdateEmployeeTest()
        {
            ConstObjectsFiller cof = new ConstObjectsFiller();

            _dataLayer            = new LibraryRepository();
            _dataLayer.DataFiller = cof;
            _dataLayer.FillData();
            Employee newEmployee = new Employee(Guid.NewGuid(), "Robert", "Mak�owicz", new DateTime(1973, 3, 12), "123456789", "*****@*****.**", Person.Gender.Male, DateTime.Now);
            Guid     id          = _dataLayer.GetAllEmployees().ElementAt(0).Id;

            Assert.ThrowsException <ArgumentException>(() => _dataLayer.UpdateEmployee(id, newEmployee));
            Assert.ThrowsException <ArgumentException>(() => _dataLayer.UpdateEmployee(Guid.NewGuid(), newEmployee));
            newEmployee = new Employee(id, "Robert", "Mak�owicz", new DateTime(1973, 3, 12), "123456789", "*****@*****.**", Person.Gender.Male, DateTime.Now);
            _dataLayer.UpdateEmployee(id, newEmployee);
            Assert.AreEqual(newEmployee.Email, _dataLayer.GetEmployee(id).Email);
            Assert.AreEqual(newEmployee.Name, _dataLayer.GetEmployee(id).Name);
        }