コード例 #1
0
ファイル: TextCapture.cs プロジェクト: rfregosa/nunit
        /// <summary>
        /// Writes a string followed by a line terminator
        /// </summary>
        /// <param name="value">The string to write</param>
        public override void WriteLine(string value)
        {
            var context = TestExecutionContext.GetTestExecutionContext();

            if (context != null && context.CurrentResult != null)
            {
                context.CurrentResult.OutWriter.WriteLine(value);
            }
            else
            {
                _defaultWriter.WriteLine(value);
            }
        }
コード例 #2
0
        private bool TrySendToListener(string text)
        {
            var context = TestExecutionContext.GetTestExecutionContext();

            if (context == null || context.Listener == null)
            {
                return(false);
            }

            string testName = context.CurrentTest != null
                ? context.CurrentTest.FullName
                : null;

            context.Listener.TestOutput(new TestOutput(text, _streamName, testName));
            return(true);
        }