Avatar ·

How to create a Stream from a string in C#?

Hi everyone! I'm new to C# and writing unit tests for my application. I need to pass string data to a method that accepts a parameter of type `Stream`. For example, I'm testing a method that reads data from a stream and parses it: ```csharp public class DataProcessor { public void ProcessStream(Stream inputStream) { using (var reader = new StreamReader(inputStream)) { string data = reader.ReadToEnd(); // ... some processing logic } } } [Test] public void TestProcessStream() { string testData = "Name,Age\nAlice,30\nBob,25"; // How do I pass testData to the ProcessStream method? var processor = new DataProcessor(); processor.ProcessStream(???); // What should I write here? } ``` The problem is that