Skip to content

Instantly share code, notes, and snippets.

@eamonnmcevoy
Created March 29, 2017 07:33
Show Gist options
  • Save eamonnmcevoy/4d2b463246393109704b078622e2aeb3 to your computer and use it in GitHub Desktop.
Save eamonnmcevoy/4d2b463246393109704b078622e2aeb3 to your computer and use it in GitHub Desktop.
Example of un-testable class
using System.Text;
using System;
namespace BigLegacyApplication
{
internal class ReportGenerator
{
public ReportGenerator()
{
}
internal string GetUserReport(int userId)
{
var userService = new UserService();
var user = userService.GetUser(userId);
var resultsService = new ResultsService();
var results = resultsService.GetUserResults(userId);
var sb = new StringBuilder();
sb.AppendLine(string.Format("{0} {1}", user.Firstname, user.Surname));
sb.AppendLine(string.Join(",", results));
sb.AppendLine(string.Format("Date: {0}", DateTime.Now.ToString()));
return sb.ToString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment