Skip to content

Commit 9b7252b

Browse files
committed
Move directory-aware Touch() up into BaseFixture
1 parent 26fccaf commit 9b7252b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

LibGit2Sharp.Tests/CurrentOperationFixture.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,5 @@ public void CurrentOperationHasExpectedPendingOperationValues(string stateFile,
5050
Assert.Equal(expectedState, repo.Info.CurrentOperation);
5151
}
5252
}
53-
54-
private void Touch(string parent, string file)
55-
{
56-
var lastIndex = file.LastIndexOf('/');
57-
if (lastIndex > 0)
58-
{
59-
var parents = file.Substring(0, lastIndex);
60-
Directory.CreateDirectory(Path.Combine(parent, parents));
61-
}
62-
63-
var filePath = Path.Combine(parent, file);
64-
File.AppendAllText(filePath, string.Empty, Encoding.ASCII);
65-
}
6653
}
6754
}

LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,5 +175,18 @@ private static RepositoryOptions BuildFakeRepositoryOptions(SelfCleaningDirector
175175
SystemConfigurationLocation = systemLocation,
176176
};
177177
}
178+
179+
protected void Touch(string parent, string file, string content = null)
180+
{
181+
var lastIndex = file.LastIndexOf('/');
182+
if (lastIndex > 0)
183+
{
184+
var parents = file.Substring(0, lastIndex);
185+
Directory.CreateDirectory(Path.Combine(parent, parents));
186+
}
187+
188+
var filePath = Path.Combine(parent, file);
189+
File.AppendAllText(filePath, content ?? string.Empty, Encoding.ASCII);
190+
}
178191
}
179192
}

0 commit comments

Comments
 (0)