Ejemplo n.º 1
0
Archivo: Assume.cs Proyecto: jnm2/nunit
        private static void ReportFailure(ConstraintResult result, string message, object[] args)
        {
            MessageWriter writer = new TextMessageWriter(message, args);

            result.WriteMessageTo(writer);
            throw new InconclusiveException(writer.ToString());
        }
Ejemplo n.º 2
0
        private static void IssueWarning(ConstraintResult result, string message, object[] args)
        {
            MessageWriter writer = new TextMessageWriter(message, args);

            result.WriteMessageTo(writer);
            Assert.Warn(writer.ToString());
        }
Ejemplo n.º 3
0
        private static void ReportFailure(ConstraintResult result, string message, params object[] args)
        {
            MessageWriter writer = new TextMessageWriter(message, args);

            result.WriteMessageTo(writer);

            ReportFailure(writer.ToString());
        }
Ejemplo n.º 4
0
        private string getMessage(ConstraintResult result)
        {
            string message = string.Empty;

            if (!result.IsSuccess)
            {
                var writer = new TextMessageWriter();
                result.WriteMessageTo(writer);

                message = writer.ToString();
            }

            return(message);
        }
Ejemplo n.º 5
0
        private static void ReportFailure(ConstraintResult result, string message, params object[] args)
        {
            MessageWriter writer = new TextMessageWriter(message, args);

            result.WriteMessageTo(writer);
            string formattedMessage = writer.ToString();
            string stackTrace       = GetStackTrace();

            // Failure is recorded in <assertion> element in all cases
            TestExecutionContext.CurrentContext.CurrentResult.RecordAssertion(
                AssertionStatus.Failed, formattedMessage, stackTrace);

            // If we are outside any multiple assert block, then throw
            if (TestExecutionContext.CurrentContext.MultipleAssertLevel == 0)
            {
                throw new AssertionException(formattedMessage);
            }
        }
Ejemplo n.º 6
0
 public override void WriteMessageTo(MessageWriter writer)
 {
     _result.WriteMessageTo(writer);
 }
Ejemplo n.º 7
0
 public void WriteTo(MessageWriter writer) => constraintResult.WriteMessageTo(writer);
Ejemplo n.º 8
0
 /// <inheritdoc/>
 public override void WriteMessageTo(MessageWriter writer)
 {
     writer.Write("XML with XPath {0}", constraint.xPath);
     nestedResult.WriteMessageTo(writer);
 }