-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #304 from JakeGinnivan/hmemcpymaster
Making UpdateAssemblyInfo to only consider files under the workingDirectory
- Loading branch information
Showing
8 changed files
with
105 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace GitVersionExe.Tests | ||
{ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using GitVersion; | ||
using NSubstitute; | ||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class AssemblyInfoFileUpdateTests | ||
{ | ||
[Test] | ||
public void ShouldStartSearchFromWorkingDirectory() | ||
{ | ||
var fileSystem = Substitute.For<IFileSystem>(); | ||
const string workingDir = "C:\\Testing"; | ||
using (new AssemblyInfoFileUpdate(new Arguments{ UpdateAssemblyInfo = true }, workingDir, new Dictionary<string, string>(), fileSystem)) | ||
{ | ||
fileSystem.Received().DirectoryGetFiles(Arg.Is(workingDir), Arg.Any<string>(), Arg.Any<SearchOption>()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace GitVersion | ||
{ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
|
||
class FileSystem : IFileSystem | ||
{ | ||
public void Copy(string @from, string to, bool overwrite) | ||
{ | ||
File.Copy(from, to, overwrite); | ||
} | ||
|
||
public void Move(string @from, string to) | ||
{ | ||
File.Move(from, to); | ||
} | ||
|
||
public bool Exists(string file) | ||
{ | ||
return File.Exists(file); | ||
} | ||
|
||
public void Delete(string path) | ||
{ | ||
File.Delete(path); | ||
} | ||
|
||
public string ReadAllText(string path) | ||
{ | ||
return File.ReadAllText(path); | ||
} | ||
|
||
public void WriteAllText(string file, string fileContents) | ||
{ | ||
File.WriteAllText(file, fileContents); | ||
} | ||
|
||
public IEnumerable<string> DirectoryGetFiles(string directory, string searchPattern, SearchOption searchOption) | ||
{ | ||
return Directory.GetFiles(directory, searchPattern, searchOption); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace GitVersion | ||
{ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
|
||
public interface IFileSystem | ||
{ | ||
void Copy(string from, string to, bool overwrite); | ||
void Move(string from, string to); | ||
bool Exists(string file); | ||
void Delete(string path); | ||
string ReadAllText(string path); | ||
void WriteAllText(string file, string fileContents); | ||
IEnumerable<string> DirectoryGetFiles(string directory, string searchPattern, SearchOption searchOption); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters