Пример #1
0
        public virtual void Dispose()
        {
            // Disposing the json writer closes the stream but the textwriter
            // still needs to be disposed or closed to write the results
            if (_issueLogJsonWriter != null)
            {
                _issueLogJsonWriter.CloseResults();

                if (_run?.Invocations?.Count > 0 && _run.Invocations[0].StartTimeUtc != new DateTime() &&
                    !_dataToRemove.HasFlag(OptionallyEmittedData.NondeterministicProperties))
                {
                    _run.Invocations[0].EndTimeUtc = DateTime.UtcNow;
                }

                _issueLogJsonWriter.CompleteRun();
                _issueLogJsonWriter.Dispose();
            }

            if (_closeWriterOnDispose)
            {
                if (_textWriter != null)
                {
                    _textWriter.Dispose();
                }
                if (_jsonTextWriter == null)
                {
                    _jsonTextWriter.Close();
                }
            }

            GC.SuppressFinalize(this);
        }
Пример #2
0
        public virtual void Dispose()
        {
            // Disposing the json writer closes the stream but the textwriter
            // still needs to be disposed or closed to write the results
            if (_issueLogJsonWriter != null)
            {
                _issueLogJsonWriter.CloseResults();

                if (_run?.Invocations?.Count > 0 && _run.Invocations[0].StartTimeUtc != new DateTime())
                {
                    _run.Invocations[0].EndTimeUtc = DateTime.UtcNow;
                }

                _issueLogJsonWriter.CompleteRun();
                _issueLogJsonWriter.Dispose();
            }

            if (_textWriter != null)
            {
                _textWriter.Dispose();
            }

            if (_jsonTextWriter == null)
            {
                _jsonTextWriter.Close();
            }

            GC.SuppressFinalize(this);
        }