Created
May 8, 2012 21:06
-
-
Save nulltoken/2639280 to your computer and use it in GitHub Desktop.
(LibGit bug?] Surprisingly failing test
This file contains hidden or 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
[Fact] | |
public void RetrievingTheStatusOfARepositoryReturnNativeFilePaths() | |
{ | |
// Initialize a new repository | |
SelfCleaningDirectory scd = BuildSelfCleaningDirectory(); | |
const string directoryName = "directory"; | |
const string fileName = "Testfile.txt"; | |
// Create a file and insert some content | |
string directoryPath = Path.Combine(scd.RootedDirectoryPath, directoryName); | |
string filePath = Path.Combine(directoryPath, fileName); | |
Directory.CreateDirectory(directoryPath); | |
File.WriteAllText(filePath, "Anybody out there?"); | |
// Open the repository | |
using (Repository repo = Repository.Init(scd.DirectoryPath)) | |
{ | |
var status = repo.Index.RetrieveStatus(filePath); | |
status.ShouldEqual(FileStatus.Untracked); | |
// Add the file to the index | |
repo.Index.Stage(filePath); | |
status = repo.Index.RetrieveStatus(filePath); | |
status.ShouldEqual(FileStatus.Added); | |
// Get the repository status | |
RepositoryStatus repoStatus = repo.Index.RetrieveStatus(); | |
repoStatus.Count().ShouldEqual(1); | |
StatusEntry statusEntry = repoStatus.Single(); | |
string expectedPath = string.Format("{0}{1}{2}", directoryName, Path.DirectorySeparatorChar, fileName); | |
statusEntry.FilePath.ShouldEqual(expectedPath); | |
repoStatus.Added.Single().ShouldEqual(statusEntry.FilePath); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment