Skip to content

Instantly share code, notes, and snippets.

@codescribler
Last active August 29, 2015 14:00
Show Gist options
  • Save codescribler/cfaeaf94b086c2112dad to your computer and use it in GitHub Desktop.
Save codescribler/cfaeaf94b086c2112dad to your computer and use it in GitHub Desktop.
public class Scribe2
{
private IWrapFile fileService;
public Scribe2(IWrapFile file)
{
fileService = file;
}
public void SaveMessage(string file, string data)
{
if (fileService.Exists(file)) // Now uses the injected IWrapFile service
{
throw new Exception("File name must be unique");
}
fileService.WriteAllText(file, data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment