コード例 #1
0
        public RecordedOutput Record(Action action)
        {
            _state = new RecordingState();

            action();

            var recordedOutput = new RecordedOutput(_state.RecordedContentType, _state.RecordedContent);

            _state = new NormalState();

            return(recordedOutput);
        }
コード例 #2
0
        public RecordedOutput Record(Action action)
        {
            _state = new RecordingState();

            action();

            var recordedOutput = new RecordedOutput(_state.RecordedContentType, _state.RecordedContent);

            _state = new NormalState();

            return recordedOutput;
        }
コード例 #3
0
        public virtual IRecordedOutput Record(Action action)
        {
            var output = new RecordedOutput(_fileSystem);

            _outputStates.Push(output);

            try
            {
                action();
            }
            finally
            {
                _outputStates.Pop();
            }

            return(output);
        }
コード例 #4
0
ファイル: OutputWriter.cs プロジェクト: rmueller/fubumvc
        public virtual IRecordedOutput Record(Action action)
        {
            var output = new RecordedOutput(_fileSystem);

            _state = output;

            try
            {
                action();
            }
            finally
            {
                revertToNormalWriting();
            }

            return(output);
        }
コード例 #5
0
        public virtual IRecordedOutput Record(Action action)
        {
            _logger.DebugMessage(() => new StartedRecordingOutput());

            var output = new RecordedOutput(_fileSystem);

            _outputStates.Push(output);

            try
            {
                action();
            }
            finally
            {
                _outputStates.Pop();

                _logger.DebugMessage(() => new FinishedRecordingOutput(output));
            }

            return(output);
        }
コード例 #6
0
        public virtual async Task <IRecordedOutput> Record(Func <Task> inner)
        {
            _logger.DebugMessage(() => new StartedRecordingOutput());

            var output = new RecordedOutput(_fileSystem);

            _outputStates.Push(output);

            try
            {
                await inner().ConfigureAwait(false);
            }
            finally
            {
                _outputStates.Pop();

                _logger.DebugMessage(() => new FinishedRecordingOutput(output));
            }

            return(output);
        }