public void CreateBindMounts(BindMount[] bindMounts, IContainerUser containerUser) { foreach (var bindMount in bindMounts) { var mappedDestinationPath = MapUserPath(bindMount.DestinationPath); fileSystem.CreateDirectory(mappedDestinationPath, GetContainerUserAccess(containerUser.UserName, FileAccess.ReadWrite)); fileSystem.Copy(bindMount.SourcePath, mappedDestinationPath); } }
public void CopyFileTest() { var path = _paths.Combine(_baseDirectory, "copy/tmp-file.txt"); var dest = _paths.Combine(_baseDirectory, "copy/tmp-file-copy.txt"); CreateFile(path, "This should get deleted"); _scanner.Exists(dest).Should().BeFalse("The destination file should not already exist"); _scanner.Exists(path).Should().BeTrue("The file didnt get created so cant be deleted in the test"); _manager.Copy(path, dest); _scanner.Exists(dest).Should().BeTrue("The destination needs to have been created"); Action a = () => { _manager.Delete(dest); _manager.Delete(path); }; a.ShouldNotThrow(); }