diff --git a/src/Husky/Cli/AttachCommand.cs b/src/Husky/Cli/AttachCommand.cs index 2d8d454..2adbb41 100644 --- a/src/Husky/Cli/AttachCommand.cs +++ b/src/Husky/Cli/AttachCommand.cs @@ -89,7 +89,7 @@ private string GetInstallCommand() private async Task GetRelativePath(string filepath) { var gitPath = await _git.GetGitPathAsync(); - var fileInfo = _io.FileInfo.FromFileName(filepath); + var fileInfo = _io.FileInfo.New(filepath); var relativePath = Path.GetRelativePath(fileInfo.DirectoryName!, gitPath); return relativePath; } diff --git a/src/Husky/Cli/ExecCommand.cs b/src/Husky/Cli/ExecCommand.cs index b6bbab9..64d16c3 100644 --- a/src/Husky/Cli/ExecCommand.cs +++ b/src/Husky/Cli/ExecCommand.cs @@ -165,7 +165,7 @@ internal async ValueTask ExecuteScript(string scriptPath) internal async Task<(bool, string)> GetCachedScript(string scriptPath) { var cacheFolder = await GetHuskyCacheFolder(); - await using var fileStream = _fileSystem.FileStream.Create(scriptPath, FileMode.Open); + await using var fileStream = _fileSystem.FileStream.New(scriptPath, FileMode.Open); var hash = await CalculateHashAsync(fileStream); diff --git a/src/Husky/Cli/InstallCommand.cs b/src/Husky/Cli/InstallCommand.cs index 39728fd..83320d8 100644 --- a/src/Husky/Cli/InstallCommand.cs +++ b/src/Husky/Cli/InstallCommand.cs @@ -189,7 +189,7 @@ private async Task ConfigureGitAndFilePermission(string path, string husky_shPat $"Configuring Git and File permissions in '{husky_shPath}'".LogVerbose(); // find all hooks (if exists) from .husky/ and add executable flag - var files = _fileSystem.Directory.GetFiles(path).Where(f => !_fileSystem.FileInfo.FromFileName(f).Name.Contains('.')).ToList(); + var files = _fileSystem.Directory.GetFiles(path).Where(f => !_fileSystem.FileInfo.New(f).Name.Contains('.')).ToList(); files.Add(husky_shPath); await _cliWrap.SetExecutablePermission(files.ToArray()); diff --git a/src/Husky/Husky.csproj b/src/Husky/Husky.csproj index 3631461..38552f3 100644 --- a/src/Husky/Husky.csproj +++ b/src/Husky/Husky.csproj @@ -42,14 +42,13 @@ - - - - - - - - + + + + + + + diff --git a/tests/HuskyIntegrationTests/HuskyIntegrationTests.csproj b/tests/HuskyIntegrationTests/HuskyIntegrationTests.csproj index 288284c..ab40c6c 100644 --- a/tests/HuskyIntegrationTests/HuskyIntegrationTests.csproj +++ b/tests/HuskyIntegrationTests/HuskyIntegrationTests.csproj @@ -11,16 +11,18 @@ - - - - - - + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/HuskyTest/Cli/AttachCommandTests.cs b/tests/HuskyTest/Cli/AttachCommandTests.cs index 9a08b4a..9d43ed8 100644 --- a/tests/HuskyTest/Cli/AttachCommandTests.cs +++ b/tests/HuskyTest/Cli/AttachCommandTests.cs @@ -31,7 +31,7 @@ public AttachCommandTests() _git.GetGitPathAsync().Returns(_currentDirectory); // usually same as current directory but can be different _io = Substitute.For(); var fileInfoWrapper = new FileInfoWrapper(_io, new FileInfo(Path.Combine(_currentDirectory, _fileName))); - _io.FileInfo.FromFileName(Arg.Any()).Returns(fileInfoWrapper); + _io.FileInfo.New(Arg.Any()).Returns(fileInfoWrapper); _io.Directory.GetCurrentDirectory().Returns(_currentDirectory); const string _csprojXml = "netcoreapp2.1"; @@ -155,7 +155,7 @@ public async Task Attach_WorkingDirectoryShouldBeRelativePathToProjectRoot(strin _currentDirectory = currentDirectory; _fileName = fileName; var fileInfoWrapper = new FileInfoWrapper(_io, new FileInfo(Path.Combine(_currentDirectory, _fileName))); - _io.FileInfo.FromFileName(Arg.Any()).Returns(fileInfoWrapper); + _io.FileInfo.New(Arg.Any()).Returns(fileInfoWrapper); var command = new AttachCommand(_git, _io, _xmlIo) { FileName = _fileName }; // Act diff --git a/tests/HuskyTest/HuskyTest.csproj b/tests/HuskyTest/HuskyTest.csproj index 6355cf1..6d07c1b 100644 --- a/tests/HuskyTest/HuskyTest.csproj +++ b/tests/HuskyTest/HuskyTest.csproj @@ -7,15 +7,16 @@ - - - - - + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all