public void InitTest()
 {
     Assert.IsNull(_dataLayer.DataFiller);
     Assert.AreEqual(0, _dataLayer.GetAllAuthors().Count());
     Assert.AreEqual(0, _dataLayer.GetAllBooks().Count());
     Assert.AreEqual(0, _dataLayer.GetAllCopiesOfBook().Count());
     Assert.AreEqual(0, _dataLayer.GetAllReaders().Count());
     Assert.AreEqual(0, _dataLayer.GetAllEmployees().Count());
     Assert.AreEqual(0, _dataLayer.GetAllEvents().Count());
 }
        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());
        }