public void GetFileEntriesByDisc_DiscExists_GetsCorrectFileEntries()
        {
            string          dbLocation  = @"c:\temp\Files on Dvd.accdb";
            AccessRetriever myRetriever = new AccessRetriever(dbLocation);
            int             discId      = 220;
            DataSet         dataSet     = myRetriever.GetFileEntriesByDiscId(discId);
            DataTable       dt          = dataSet.Tables[0];

            int expectedCount = 4;

            Assert.AreEqual(expectedCount, dt.Rows.Count);

            Console.WriteLine("Debug this line and examine the dt object");
        }
Exemple #2
0
        private DataSet RetrieveFileEntriesFromDatabase(AccessRetriever retriever, int?discId = null)
        {
            DataSet dataSet;

            try {
                if (discId == null)
                {
                    dataSet = retriever.GetFileEntries();
                }
                else
                {
                    dataSet = retriever.GetFileEntriesByDiscId((int)discId);
                }
            }
            catch (Exception e) {
                Log.Error(e, "Could not retrieve filenames from Access DB");
                throw new InvalidOperationException("Could not retrieve filenames from Access DB", e);
            }
            if (dataSet is null)
            {
                throw new InvalidOperationException("Filenames dataSet is null");
            }
            return(dataSet);
        }