Exemplo n.º 1
0
        public async Task TestTryMoveFile()
        {
            await using var tmpDir = _snapFilesystem.WithDisposableTempDirectory(_baseFixture.WorkingDirectory);
            var srcFilenameAbsolutePath = _snapFilesystem.PathCombine(tmpDir.WorkingDirectory, "test.txt");
            var dstFilenameAbsolutePath = _snapFilesystem.PathCombine(tmpDir.WorkingDirectory, "test2.txt");
            await _snapFilesystem.FileWriteUtf8StringAsync("test", srcFilenameAbsolutePath, default);

            _snapFilesystem.TryFileMove(srcFilenameAbsolutePath, dstFilenameAbsolutePath);
            Assert.True(_snapFilesystem.FileExists(dstFilenameAbsolutePath));
            Assert.Equal("test", await _snapFilesystem.FileReadAllTextAsync(dstFilenameAbsolutePath));
        }