Skip to content

Instantly share code, notes, and snippets.

@CopperStarSystems
Created January 15, 2017 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CopperStarSystems/d09eb9c999593cc43e00e295be735508 to your computer and use it in GitHub Desktop.
Save CopperStarSystems/d09eb9c999593cc43e00e295be735508 to your computer and use it in GitHub Desktop.
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