Skip to content

Commit fbbed5c

Browse files
committed
Fixing a bug in the mock file
1 parent 9a09049 commit fbbed5c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Common/Commands.Common.Test/Mocks/MockCommandRuntime.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,18 @@ public void WriteError(ErrorRecord errorRecord)
102102

103103
public void WriteObject(object sendToPipeline, bool enumerateCollection)
104104
{
105-
OutputPipeline.Add(sendToPipeline);
105+
System.Collections.IEnumerable enumerable = LanguagePrimitives.GetEnumerable(sendToPipeline);
106+
if (enumerable != null && enumerateCollection)
107+
{
108+
foreach (object o in enumerable)
109+
{
110+
OutputPipeline.Add(o);
111+
}
112+
}
113+
else
114+
{
115+
OutputPipeline.Add(sendToPipeline);
116+
}
106117
}
107118

108119
public void WriteObject(object sendToPipeline)

0 commit comments

Comments
 (0)