public void TestUnloadDataset()
        {
            List <string> rgDs = new List <string>()
            {
                "MNIST", "CIFAR-10", "MNIST"
            };
            IXImageDatabase db = new MyCaffeImageDatabase();
            Stopwatch       sw = new Stopwatch();
            string          str;

            foreach (string strDs in rgDs)
            {
                SettingsCaffe settings = new SettingsCaffe();
                settings.ImageDbLoadMethod = IMAGEDB_LOAD_METHOD.LOAD_ALL;
                settings.ImageDbLoadLimit  = 0;

                sw.Start();
                db.InitializeWithDsName(settings, strDs);
                str = sw.ElapsedMilliseconds.ToString();
                Trace.WriteLine(strDs + " Initialization Time: " + str + " ms.");

                sw.Reset();
                sw.Stop();
            }

            sw.Stop();
            sw.Reset();

            double dfTraining;
            double dfTesting;
            double dfPctLoaded;

            dfPctLoaded = db.GetDatasetLoadedPercentByName(rgDs[0], out dfTraining, out dfTesting);
            Assert.AreEqual(1, dfPctLoaded);
            Assert.AreEqual(1, dfTraining);
            Assert.AreEqual(1, dfTesting);

            db.UnloadDatasetByName(rgDs[0]);
            Thread.Sleep(5000);

            dfPctLoaded = db.GetDatasetLoadedPercentByName(rgDs[0], out dfTraining, out dfTesting);
            Assert.AreEqual(0, dfPctLoaded);
            Assert.AreEqual(0, dfTraining);
            Assert.AreEqual(0, dfTesting);

            dfPctLoaded = db.GetDatasetLoadedPercentByName(rgDs[1], out dfTraining, out dfTesting);
            Assert.AreEqual(1, dfPctLoaded);
            Assert.AreEqual(1, dfTraining);
            Assert.AreEqual(1, dfTesting);

            db.UnloadDatasetByName(rgDs[1]);
            Thread.Sleep(5000);

            dfPctLoaded = db.GetDatasetLoadedPercentByName(rgDs[1], out dfTraining, out dfTesting);
            Assert.AreEqual(0, dfPctLoaded);
            Assert.AreEqual(0, dfTraining);
            Assert.AreEqual(0, dfTesting);

            dfPctLoaded = db.GetDatasetLoadedPercentByName(rgDs[2], out dfTraining, out dfTesting);
            Assert.AreEqual(0, dfPctLoaded);
            Assert.AreEqual(0, dfTraining);
            Assert.AreEqual(0, dfTesting);

            db.UnloadDatasetByName(rgDs[2]);
            Thread.Sleep(5000);

            dfPctLoaded = db.GetDatasetLoadedPercentByName(rgDs[2], out dfTraining, out dfTesting);
            Assert.AreEqual(0, dfPctLoaded);
            Assert.AreEqual(0, dfTraining);
            Assert.AreEqual(0, dfTesting);

            sw.Start();
            db.CleanUp();
            str = sw.ElapsedMilliseconds.ToString();
            Trace.WriteLine("Cleanup Time: " + str + " ms.");

            sw.Stop();
            sw.Reset();
            sw.Start();

            IDisposable idisp = db as IDisposable;

            if (idisp != null)
            {
                idisp.Dispose();
            }

            str = sw.ElapsedMilliseconds.ToString();
            Trace.WriteLine("Dispose Time: " + str + " ms.");
        }