public IEnumerable <string> ListStores(string baseLocation)
        {
            var directories = _persistenceManager.ListSubDirectories(baseLocation);

            foreach (var directory in directories)
            {
                if (_persistenceManager.FileExists(baseLocation + "\\" + directory + "\\masterfile.bs"))
                {
                    yield return(directory);
                }
            }
        }
        public IEnumerable <string> ListStores(string baseLocation)
        {
            foreach (var directory in _persistenceManager.ListSubDirectories(baseLocation))
            {
#if SILVERLIGHT || PORTABLE
                // Silverlight does not have a Path.Combine that takes three params
                var path = Path.Combine(Path.Combine(baseLocation, directory), MasterFile.MasterFileName);
#else
                var path = Path.Combine(baseLocation, directory, MasterFile.MasterFileName);
#endif
                if (_persistenceManager.FileExists(path))
                {
                    yield return(directory);
                }
            }
        }
        public void TestListFolders()
        {
            if (_pm.DirectoryExists("parent"))
            {
                _pm.DeleteDirectory("parent");
            }
            try
            {
                _pm.ListSubDirectories("parent");
                Assert.Fail("Expected FileNotFoundException");
            }
            catch (FileNotFoundException)
            {
                // Expected
            }

            _pm.CreateDirectory("parent");
            Assert.AreEqual(0, _pm.ListSubDirectories("parent").Count());

            _pm.CreateDirectory("parent\\child1");
            var subdirs = _pm.ListSubDirectories("parent").ToList();

            Assert.AreEqual(1, subdirs.Count);
            Assert.IsTrue(subdirs.Any(x => x.Equals("child1")));

            _pm.CreateDirectory("parent\\child2");
            subdirs = _pm.ListSubDirectories("parent").ToList();
            Assert.AreEqual(2, subdirs.Count());
            Assert.IsTrue(subdirs.Any(x => x.Equals("child1")));
            Assert.IsTrue(subdirs.Any(x => x.Equals("child2")));

            _pm.CreateDirectory("parent\\child2\\grandchild1");
            subdirs = _pm.ListSubDirectories("parent").ToList();
            Assert.AreEqual(2, subdirs.Count());
            Assert.IsTrue(subdirs.Any(x => x.Equals("child1")));
            Assert.IsTrue(subdirs.Any(x => x.Equals("child2")));
            subdirs = _pm.ListSubDirectories("parent\\child2").ToList();
            Assert.AreEqual(1, subdirs.Count());
            Assert.IsTrue(subdirs.Any(x => x.Equals("grandchild1")));
        }