public void ReadAsString_Calls_The_ActionOfStream() { bool actionCalled = false; Action <Stream> actionOfStream = (stream) => { StreamWriter writer = new StreamWriter(stream); writer.Write("Hello"); writer.Flush(); actionCalled = true; }; ActionOfStreamContent content = new ActionOfStreamContent(actionOfStream); Assert.IsFalse(actionCalled, "The actionOfStream should not have been called yet."); Assert.AreEqual("Hello", content.ReadAsString(), "The content should have been 'Hello'."); Assert.IsTrue(actionCalled, "The actionOfStream should have been called."); }
public void ReadAsString_Calls_The_ActionOfStream() { bool actionCalled = false; Action<Stream> actionOfStream = (stream) => { StreamWriter writer = new StreamWriter(stream); writer.Write("Hello"); writer.Flush(); actionCalled = true; }; ActionOfStreamContent content = new ActionOfStreamContent(actionOfStream); Assert.IsFalse(actionCalled, "The actionOfStream should not have been called yet."); Assert.AreEqual("Hello", content.ReadAsString(), "The content should have been 'Hello'."); Assert.IsTrue(actionCalled, "The actionOfStream should have been called."); }