Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple wrapper around System.IO.Path to improve testability
// Interface for mocking
public interface IPathWrapper
{
string GetFileName(string input);
}
// Wrapper over the static Path.GetFileName
public class PathWrapper : IPathWrapper
{
public string GetFileName(string input)
{
return Path.GetFileName(input);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment