Наследование: 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);
        }
Пример #5
0
        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!");
        }