示例#1
0
 public StorageFileTestContext()
 {
     _fs = new InMemoryFileSystem();
     _write = _fs.GetFile(@"c:\db.mgdat");
     _rec = _fs.GetFile(@"c:\db.mgrec");
     CreateStorage();
 }
示例#2
0
 public void Given()
 {
     _fs = new InMemoryFileSystem();
     var ks = new KeyStore<string>(_fs, new Settings(@"c:\db\raptile.db"));
     ks.Dispose();
     _dir = _fs.GetDirectory(@"c:\db");
 }
    public void can_add_sub_folders()
    {
        var fs = new InMemoryFileSystem().CreateChildDir(@"C:\mordor\nurn");
        var mordor = fs.GetDirectory(@"C:\mordor");
        mordor.Exists.ShouldBeTrue();

        var nurn = mordor.GetDirectory("nurn");
        nurn.Path.FullPath.ShouldBe(@"C:\mordor\nurn\");
        nurn.Exists.ShouldBeTrue();
    }
            protected void given_file_system(string currentDirectory)
            {
                FileSystem = new InMemoryFileSystem
                {
                        CurrentDirectory = currentDirectory
                };
                ServiceLocator.RegisterService<IFileSystem>(FileSystem);

                Environment = new InMemoryEnvironment(FileSystem.GetDirectory(currentDirectory),
                                                      FileSystem.GetDirectory(DefaultInstallationPaths.ConfigurationDirectory));
                ServiceLocator.RegisterService<IEnvironment>(Environment);
            }
    public void can_move_folder()
    {
        var fs = new InMemoryFileSystem();
        var source = fs.GetDirectory("C:\\source");
        source.GetFile("mordor.txt").MustExist();
        var destination = fs.GetDirectory("C:\\destination");
        source.MoveTo(destination);

        source.GetFile("mordor.txt").Exists.ShouldBeFalse();
        source.Exists.ShouldBeFalse();

        destination.Exists.ShouldBeTrue();
        destination.GetFile("mordor.txt").Exists.ShouldBeTrue();
    }
示例#6
0
        public msbuild_emitter()
        {
            _fileSystem = new InMemoryFileSystem();
            _emitter = new MSBuildInstructionEmitter(_fileSystem);
            RootDirectory = _fileSystem.CreateTempDirectory();
            _emitter.RootPath = RootDirectory.Path;
            ProjectDirectory = RootDirectory.GetDirectory("src").GetDirectory("Project");
            ProjectFile = ProjectDirectory.GetFile("Project.csproj");

            BinDirectory 
                = _fileSystem.CreateTempDirectory();
            GacDirectory = _fileSystem.CreateTempDirectory();
            TempDirectory = _fileSystem.CreateTempDirectory();
            BinPath = new OpenFileSystem.IO.Path(System.IO.Path.Combine(_emitter.RootPath, "bin"));
        }
        public void non_existing_file(
            [Values(FileMode.Append, FileMode.Create, FileMode.CreateNew, FileMode.Open, FileMode.OpenOrCreate, FileMode.Truncate)]FileMode mode,
            [Values(FileAccess.Read, FileAccess.ReadWrite, FileAccess.Write)]FileAccess access,
            [Values(FileShare.Delete, FileShare.None, FileShare.Read, FileShare.ReadWrite, FileShare.Write)]FileShare share)
        {
            var inMem = new InMemoryFileSystem();
            using (var memTempDir = inMem.CreateTempDirectory())
            using (var localTempDir = LocalFileSystem.Instance.CreateTempDirectory())
            {
                var memTempFile = memTempDir.GetFile(Guid.NewGuid().ToString());
                var localTempFile = localTempDir.GetFile(Guid.NewGuid().ToString());

                TestSameCore(memTempFile, localTempFile, mode, access, share);
            }
        }
        public void content_is_written_correctly()
        {
            var fs = new InMemoryFileSystem();

            using(var file = fs.CreateTempFile())
            {
                var content = string.Join(" ", Enumerable.Repeat("Test value", 5000).ToArray());
                using(var str = file.OpenWrite())
                using (var sw = new StreamWriter(str, Encoding.UTF8))
                {
                    sw.Write(content);
                }
                using (var str = file.OpenRead())
                using(var sr = new StreamReader(str, Encoding.UTF8))
                {
                    sr.ReadToEnd().ShouldBe(content);

                }
            }
        }
 public void can_add_folders_to_fs()
 {
     var fs = new InMemoryFileSystem().CreateChildDir(@"C:\mordor");
     fs.Directories.ShouldHaveCountOf(1);
 }
示例#10
0
 public descriptor_readers()
 {
     FileSystem = new InMemoryFileSystem();
 }
 public template_processor()
 {
     FileSystem = new InMemoryFileSystem();
 }
示例#12
0
 public IntegrationContext()
 {
     Defaults.PageItemCount = 1000;
     Fs = new InMemoryFileSystem();
     Settings.FileSystem = Fs;
 }
示例#13
0
 public msbuild_emitter()
 {
     _fileSystem = new InMemoryFileSystem();
     _emitter = new MSBuildInstructionEmitter(_fileSystem);
     _emitter.BasePath = Path.GetTempPath();
 }
 public file_search_context()
 {
     FileSystem = new InMemoryFileSystem();
 }
示例#15
0
 public visual_studio()
 {
     FileSystem = new InMemoryFileSystem();
     SlnDir = FileSystem.CreateTempDirectory();
 }
示例#16
0
 public IndexFileTestContext()
 {
     _fs = new InMemoryFileSystem();
     CreateIndex();
 }
示例#17
0
 public folder_repository()
 {
     file_system = new InMemoryFileSystem();
     repository_directory = file_system.CreateTempDirectory();
     source_repository = new InMemoryRepository("somewhere");
 }
 public in_memory_file_system()
 {
     FileSystem = new InMemoryFileSystem();
 }
示例#19
0
 public context_source_dir()
 {
     file_system = new InMemoryFileSystem();
     root = file_system.CreateTempDirectory();
     env = new InMemoryEnvironment(root);
 }