Skip to content

Instantly share code, notes, and snippets.

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 es-repo/4fffcf073ecb796ac195feb8ce55d010 to your computer and use it in GitHub Desktop.
Save es-repo/4fffcf073ecb796ac195feb8ce55d010 to your computer and use it in GitHub Desktop.
better-unit-test-in-c#-article-Operations-FillBox.cs
public static class Operations
{
public static Dictionary<string, Thing> FillBox(
IBox box,
IDictionary<string, Thing> labelsAndThings,
WriteLog writeLog)
{
var rest = new Dictionary<string, Thing>();
box.Open();
writeLog("The box is opened.");
foreach (var (label, thing) in labelsAndThings)
{
if (!box.PutInside(thing, label))
{
rest.Add(label, thing);
}
}
box.Close();
writeLog("The box is closed.");
return rest;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment