public void FillReaderListStaticTest()
        {
            // create FillDataRepository data object (inherits from DataInterface)
            FillDataRepositoryStatic data = new FillDataRepositoryStatic();

            // create repository using Dependency Injection pattern (pass FillDataRepository object to DataRepository constructor)
            DataRepository repository = new DataRepository(data);

            // create a data service
            DataService ds = new DataService(repository);

            // obtain a new list of filtered readers
            List <Reader> rds = null;

            rds = ds.FilterReaders("694954694");

            // expected value: true
            Assert.IsNull(rds);

            // obtain another list
            rds = ds.FilterReaders("004694694");

            // expected value: true
            Assert.AreEqual("A reader named: Bartosz Pietrzak, adress: Smetany 99, telephone number: 004694694\n\n", ds.ShowFilteredReaders(rds));
        }
        public void FillRentsCollectionStaticTest()
        {
            // create FillDataRepositoryStatic data object (inherits from DataInterface)
            FillDataRepositoryStatic data = new FillDataRepositoryStatic();

            // create repository using Dependency Injection pattern (pass FillDataRepositoryStatic object to DataRepository constructor)
            DataRepository repository = new DataRepository(data);

            // create a data service
            DataService ds = new DataService(repository);

            // obtain a new Observable Collection of filtered rents
            ObservableCollection <Rent> rents = ds.FilterRents("01/04/2016");

            // expected value: true
            Assert.AreEqual("Book: The Shining rent data:\nrented by: Bartosz Pietrzak, expire date: 01/04/2016\n\n", ds.ShowFilteredRents(rents));
        }
        public void FillBooksDictionaryStaticTest()
        {
            // create FillDataRepository data object (inherits from DataInterface)
            FillDataRepositoryStatic data = new FillDataRepositoryStatic();

            // create repository using Dependency Injection pattern (pass FillDataRepository object to DataRepository constructor)
            DataRepository repository = new DataRepository(data);

            // create a data service
            DataService ds = new DataService(repository);

            // obtain a new dictionary of filtered books
            Dictionary <int, Book> dictionary = ds.FilterBooks("Harper Lee");

            // expected value: true
            Assert.AreEqual("A book entitled: Zabić drozda, author: Harper Lee\n\n", ds.ShowFilteredBooks(dictionary));
        }
        public void EfficiencyTest()
        {
            Stopwatch stopWatch = new Stopwatch();

            // check the time of the static mode
            stopWatch.Start();

            // create FillDataRepositoryStatic fillData object (inherits from DataInterface)
            FillDataRepositoryStatic fillData = new FillDataRepositoryStatic();

            // create a repository using Dependency Injection pattern (pass FillDataRepositoryStatic object to DataRepository constructor)
            DataRepository repository = new DataRepository(fillData);

            // create a data service
            DataService ds = new DataService(repository);

            // elapsed time (ms)
            stopWatch.Stop();
            double staticTime = stopWatch.Elapsed.TotalMilliseconds;

            stopWatch.Reset();

            // check the time of the file mode
            stopWatch.Start();

            // create FillDataRepositoryFile fileData object (inherits from DataInterface)
            FillDataRepositoryFile fileData = new FillDataRepositoryFile();

            // create a repository using Dependency Injection pattern (pass FillDataRepositoryFile object to DataRepository constructor)
            DataRepository dr = new DataRepository(fileData);

            // create a data service
            DataService dataService = new DataService(dr);

            // elapsed time (ms)
            stopWatch.Stop();
            double fileTime = stopWatch.Elapsed.TotalMilliseconds;

            // expected value: true
            Assert.IsTrue(fileTime > staticTime);
        }