How to create an instance of System.IO.Stream stream in your Tests

Sami C.
1 min readNov 14, 2019

--

Today I had to pass an empty stream for my unit test. After a quick lookup i found out you can simply create an MemoryStream Object:

new MemoryStream(); //empty stream

More information on MemoryStream can be found on the Microsoft Documentation:

Happy Programming!

--

--

Sami C.
Sami C.

Written by Sami C.

Freelance Software Engineer

No responses yet