Last active
July 28, 2022 21:49
-
-
Save es-repo/4fffcf073ecb796ac195feb8ce55d010 to your computer and use it in GitHub Desktop.
better-unit-test-in-c#-article-Operations-FillBox.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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