Example #1
0
        public void GetDirectoryByNameWithNull()
        {
            // Setup
            var fileSystem = new PathTree <string>();
            var directory  = new PathDirectory <string>(fileSystem, @"x:\mydirectory");

            // Execute
            directory.File(a_name: null);
        }
Example #2
0
        public void GetChildFileByName()
        {
            // Setup
            var created      = DateTime.UtcNow;
            var lastModified = DateTime.UtcNow;
            var fileSystem   = new PathTree <string>();

            fileSystem.CreateFile(@"x:\mydirectory\file1.dat", "Value1");
            fileSystem.CreateFile(@"x:\mydirectory\file2.dat", "Value2");
            fileSystem.CreateFile(@"x:\mydirectory\file3.dat", "Value3");
            fileSystem.CreateFile(@"x:\mydirectory\otherdirectory\file4.dat", "Value4");
            var directory = new PathDirectory <string>(fileSystem, @"x:\mydirectory");

            // Execute
            var result = directory.File("File1.dat");

            // Assert
            Assert.AreEqual("File1.dat", result.Name);
            Assert.IsTrue(result.Exists);
            Assert.AreEqual("Value1", result.Value);
        }
Example #3
0
        public void GetFileByNameWithNull()
        {
            // Setup
            var fileSystem = new PathTree<string>();
            var directory = new PathDirectory<string>(fileSystem, @"x:\mydirectory");

            // Execute
            directory.File(a_name: null);
        }
Example #4
0
        public void GetChildFileByName()
        {
            // Setup
            var created = DateTime.UtcNow;
            var lastModified = DateTime.UtcNow;
            var fileSystem = new PathTree<string>();
            fileSystem.CreateFile(@"x:\mydirectory\file1.dat", "Value1");
            fileSystem.CreateFile(@"x:\mydirectory\file2.dat", "Value2");
            fileSystem.CreateFile(@"x:\mydirectory\file3.dat", "Value3");
            fileSystem.CreateFile(@"x:\mydirectory\otherdirectory\file4.dat", "Value4");
            var directory = new PathDirectory<string>(fileSystem, @"x:\mydirectory");

            // Execute
            var result = directory.File("File1.dat");

            // Assert
            Assert.AreEqual("File1.dat", result.Name);
            Assert.IsTrue(result.Exists);
            Assert.AreEqual("Value1", result.Value);
        }