예제 #1
0
        public void GetFilePathByName()
        {
            // Setup
            var created      = DateTime.UtcNow;
            var lastModified = DateTime.UtcNow;
            var fileSystem   = new TestFileSystem();

            fileSystem.StageFile(@"x:\mydirectory\file1.dat", new TestFileInstance {
                Size = 1024, CreatedTimeUtc = created, LastModifiedTimeUtc = lastModified
            });
            fileSystem.StageFile(@"x:\mydirectory\file2.dat", new TestFileInstance {
                Size = 14067, CreatedTimeUtc = created, LastModifiedTimeUtc = lastModified
            });
            fileSystem.StageFile(@"x:\mydirectory\file3.dat", new TestFileInstance {
                Size = 2017, CreatedTimeUtc = created, LastModifiedTimeUtc = lastModified
            });
            fileSystem.StageFile(@"x:\mydirectory\otherdirectory\file4.dat", new TestFileInstance {
                Size = 8740, CreatedTimeUtc = created, LastModifiedTimeUtc = lastModified
            });
            var directory = new TestDirectory(fileSystem, @"x:\mydirectory");

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

            // Assert
            Assert.AreEqual(@"x:\mydirectory\File1.dat", result);
        }
예제 #2
0
        public void GetFilePathByName()
        {
            // Setup
            var created = DateTime.UtcNow;
            var lastModified = DateTime.UtcNow;
            var fileSystem = new TestFileSystem();
            fileSystem.StageFile(@"x:\mydirectory\file1.dat", new TestFileInstance { Size = 1024, CreatedTimeUtc = created, LastModifiedTimeUtc = lastModified });
            fileSystem.StageFile(@"x:\mydirectory\file2.dat", new TestFileInstance { Size = 14067, CreatedTimeUtc = created, LastModifiedTimeUtc = lastModified });
            fileSystem.StageFile(@"x:\mydirectory\file3.dat", new TestFileInstance { Size = 2017, CreatedTimeUtc = created, LastModifiedTimeUtc = lastModified });
            fileSystem.StageFile(@"x:\mydirectory\otherdirectory\file4.dat", new TestFileInstance { Size = 8740, CreatedTimeUtc = created, LastModifiedTimeUtc = lastModified });
            var directory = new TestDirectory(fileSystem, @"x:\mydirectory");

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

            // Assert
            Assert.AreEqual(@"x:\mydirectory\File1.dat", result);
        }