public void AddDirectory(string absDirPath)
        {
            var di = SledUtil.CreateDirectoryInfo(absDirPath, true);

            if (di == null)
            {
                return;
            }

            AddDirectory(di);
        }
Esempio n. 2
0
        public void CreateDirectoryInfo()
        {
            var assem = Assembly.GetExecutingAssembly();

            Assert.That(assem != null);

            var dir1 = Path.GetDirectoryName(assem.Location);

            Assert.That(!string.IsNullOrEmpty(dir1));
            Assert.That(Directory.Exists(dir1));

            {
                var di = SledUtil.CreateDirectoryInfo(dir1, true);
                Assert.That(di != null);
                Assert.That(di.Exists);
            }

            var dir2 = Path.Combine(dir1 + Path.DirectorySeparatorChar, RandomDirName);

            Assert.That(!string.IsNullOrEmpty(dir2));
            Assert.That(!Directory.Exists(dir2));

            {
                // Since the directory doesn't exist we
                // shouldn't get a DirectoryInfo back
                var di = SledUtil.CreateDirectoryInfo(dir2, true);
                Assert.That(di == null);
            }

            {
                // Since the directory doesn't exist we
                // shouldn't get a DirectoryInfo back
                var di = SledUtil.CreateDirectoryInfo(dir2, false);
                Assert.That(di != null);
                Assert.That(!di.Exists);
            }
        }