Inheritance: IRecordedHttpOutput
示例#1
0
        public void Write(string contentType, Action<Stream> action)
        {
            output = new SetContentType(contentType);

            var stream = new MemoryStream();
            action(stream);

            output = new WriteStream(stream);
        }
示例#2
0
        public void Write(string contentType, Action <Stream> action)
        {
            output = new SetContentType(contentType);

            var stream = new MemoryStream();

            action(stream);

            output = new WriteStream(stream);
        }
示例#3
0
        public Task Write(string contentType, Func<Stream, Task> action)
        {
            output = new SetContentType(contentType);

            var stream = new MemoryStream();
            action(stream);

            output = new WriteStream(stream);

            return Task.CompletedTask;
        }
示例#4
0
        public Task Write(string contentType, Func <Stream, Task> action)
        {
            output = new SetContentType(contentType);

            var stream = new MemoryStream();

            action(stream);

            output = new WriteStream(stream);

            return(Task.CompletedTask);
        }
        public void WriteStream_Replay_copies_to_a_stream()
        {
            var stream = new MemoryStream();
            var writer = new StreamWriter(stream);
            writer.WriteLine("Hello!");
            writer.Flush();

            var writeStream = new WriteStream(stream);

            var recordingWriter = new RecordingHttpWriter();

            writeStream.Replay(recordingWriter);

            recordingWriter.AllText().Trim().ShouldEqual("Hello!");
        }