MessageWriter is the abstract base for classes that write constraint descriptions and messages in some form. The class has separate methods for writing various components of a message, allowing implementations to tailor the presentation as needed.
Inheritance: System.IO.StringWriter
コード例 #1
0
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteActualValue(" found count (" + MatchCount.ToString() + ")");
     writer.Write("[");
     baseConstraint.WriteDescriptionTo(writer);
     writer.WriteMessageLine("] expected count of {0}", countOccurrence );
 }
コード例 #2
0
 /// <summary>
 /// Write the constraint description to a MessageWriter
 /// </summary>
 /// <param name="writer">The writer on which the description is displayed</param>
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.WritePredicate("String matching");
     writer.WriteExpectedValue(this.expected);
     if (this.caseInsensitive)
         writer.WriteModifier("ignoring case");
 }
コード例 #3
0
		/// <summary>
		/// Write the actual value for a failing constraint test to a
		/// MessageWriter. The default implementation simply writes
		/// the raw value of actual, leaving it to the writer to
		/// perform any formatting.
		/// </summary>
		/// <param name="writer">The writer on which the actual value is displayed</param>
		public override void WriteActualValueTo(MessageWriter writer)
		{
			if ( propertyExists )
				writer.WriteActualValue( propValue );
			else
				writer.WriteActualValue( actual.GetType() );
		}
コード例 #4
0
 /// <summary>
 /// Write the constraint description to a MessageWriter
 /// </summary>
 /// <param name="writer">The writer on which the description is displayed</param>
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     if (baseConstraint == null)
         writer.WritePredicate("an exception");
     else
         baseConstraint.WriteDescriptionTo(writer);
 }
コード例 #5
0
        public override void WriteDescriptionTo(NUnitCtr.MessageWriter writer)
        {
            if (Configuration?.FailureReportProfile.Format == FailureReportFormat.Json)
                return;

            writer.WriteLine("No duplicated row.");
        }
コード例 #6
0
        public override void WriteActualValueTo(NUnitCtr.MessageWriter writer)
        {
            if (Configuration?.FailureReportProfile.Format == FailureReportFormat.Json)
                return;

            writer.WriteLine(failure.RenderActual());
        }
コード例 #7
0
ファイル: ContainConstraint.cs プロジェクト: zyh329/nbi
        /// <summary>
        /// Write a description of the constraint to a MessageWriter
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteDescriptionTo(MessageWriter writer)
        {
            var description = new DescriptionStructureHelper();
            var filterExpression = description.GetFilterExpression(Request.GetAllFilters());

            if (Expected.Count() == 1)
            {
                writer.WritePredicate(string.Format("find a {0} named '{1}' contained {2}",
                    description.GetTargetExpression(Request.Target),
                    Expected.First(),
                    filterExpression));
            }
            else
            {
                var expectationExpression = new StringBuilder();
                foreach (string item in Expected)
                    expectationExpression.AppendFormat("<{0}>, ", item);
                expectationExpression.Remove(expectationExpression.Length - 2, 2);

                writer.WritePredicate(string.Format("find the {0} named '{1}' contained {2}",
                    description.GetTargetPluralExpression(Request.Target),
                    expectationExpression.ToString(),
                    filterExpression));
            }
        }
コード例 #8
0
 protected override void WriteFailureMessageTo(MessageWriter writer)
 {
     if (caseInsensitive)
         writer.WriteMessageLine(msg_DoesNotContain_IC);
     else
         writer.WriteMessageLine(msg_DoesNotContain);
 }
コード例 #9
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     //WritePredicateTo(writer);
     writer.WriteExpectedValue(expected);
     //if (ignoreCase)
     //    writer.Write(" ignoring case");
 }
コード例 #10
0
ファイル: ExistsConstraint.cs プロジェクト: zyh329/nbi
        public override void WriteActualValueTo(MessageWriter writer)
        {
            //IF actual is not empty it means we've an issue with Casing or a space at the end
            if (actual is IEnumerable<IField> && ((IEnumerable<IField>)actual).Count() == 1)
            {
                if (((IEnumerable<IField>)actual).ToArray()[0].Caption.ToLowerInvariant() == Expected.ToLowerInvariant())
                    writer.WriteActualValue(string.Format("< <{0}> > (case not matching)", ((IEnumerable<IField>)actual).ToArray()[0].Caption));
                else if (((IEnumerable<IField>)actual).ToArray()[0].Caption.EndsWith(" "))
                    writer.WriteActualValue(string.Format("< <{0}> > (with ending space(s))", ((IEnumerable<IField>)actual).ToArray()[0].Caption));
                else
                    writer.WriteActualValue(string.Format("< <{0}> > (small difference)", ((IEnumerable<IField>)actual).ToArray()[0].Caption));

            }
            else
            {
                Investigate();

                if (actual is IEnumerable<IField> && ((IEnumerable<IField>)actual).Count() > 0)
                    base.WriteActualValueTo(writer);
                else
                    writer.WriteActualValue(new WriterHelper.NothingFoundMessage());

                var closeMatch = GetCloseMatch();
                if (!string.IsNullOrEmpty(closeMatch))
                {
                    writer.WriteMessageLine("");
                    writer.WriteMessageLine("");
                    writer.WriteMessageLine(string.Format("The value '{0}' is close to your expectation.", closeMatch));
                    writer.DisplayStringDifferences(Expected, closeMatch, -1, false, true);
                }
            }
        }
コード例 #11
0
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteMessageLine("Left part failed reason:\n\t");
     leftConstraint.WriteActualValueTo(writer);
     writer.WriteMessageLine("Right part failed reason:\n\t");
     rightConstraint.WriteActualValueTo(writer);
 }
コード例 #12
0
 public override void WriteActualValueTo(MessageWriter writer)
 {
     if (actual is IEnumerable<IField> && ((IEnumerable<IField>)actual).Count() > 0)
         base.WriteActualValueTo(writer);
     else
         writer.WriteActualValue(new WriterHelper.NothingFoundMessage());
 }
コード例 #13
0
ファイル: RowCountConstraint.cs プロジェクト: kalyon/NBi
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     base.WriteMessageTo(writer);
     writer.WriteLine();
     writer.WriteLine("Actual result-set returned by the query:");
     writer.WriteLine(Failure.RenderActual());
 }
コード例 #14
0
 /// <summary>
 /// Write the constraint description to a MessageWriter
 /// </summary>
 /// <param name="writer">The writer on which the description is displayed</param>
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     //if (actual is string)
     //    writer.WriteExpected(string.Empty);
     //else
         writer.Write("<empty>");
 }
コード例 #15
0
ファイル: Constraints.cs プロジェクト: pusp/o2platform
		public override void WriteMessageTo(MessageWriter writer) {
			if (this.actual is IProperty) {
				writer.WriteMessageLine("Expected {0} to have an empty {1} accessor but it was not empty {2}.", this.actual, this.accessorText, this.RegionToTest);
			} else {
				writer.WriteMessageLine("{0} is not an IProperty; cannot test for the emptiness of a {1} accessor.", this.actual, this.accessorText);
			}
		}
コード例 #16
0
        public override void WriteMessageTo(MessageWriter writer)
        {
            foreach (var pair in _Members.Where(item => !item.Value.IsSuccess))
            {
                var member = pair.Key;
                var result = pair.Value;
                var type = "void";

                if (member is PropertyInfo)
                {
                    type = (member as PropertyInfo).PropertyType.Name;
                }

                if (member is FieldInfo)
                {
                    type = (member as FieldInfo).FieldType.Name;
                }

                writer.Write(
                    "{0}Property [{1} {2}.{3}]\n",
                    _Prefix,
                    type,
                    member.DeclaringType.Name,
                    member.Name
                );

                var twin = result as TwinConstraintResult;
                if (twin != null)
                {
                    twin._Prefix = string.Concat(_Prefix, "-- ");
                }

                result.WriteMessageTo(writer);
            }
        }
コード例 #17
0
        protected void DisplayDifferences(NUnitCtr.MessageWriter writer, ResultSetCompareResult compareResult)
        {
            if (compareResult.Unexpected.Count > 0)
            {
                writer.WriteLine("  Unexpected rows:");
                writer.WriteLine();
                FormatResultSet(writer, compareResult.Unexpected, false);
                writer.WriteLine();
            }

            if (compareResult.Missing.Count > 0)
            {
                writer.WriteLine("  Missing rows:");
                writer.WriteLine();
                FormatResultSet(writer, compareResult.Missing, false);
                writer.WriteLine();
            }

            if (compareResult.Duplicated.Count > 0)
            {
                writer.WriteLine("  Duplicated rows:");
                writer.WriteLine();
                FormatResultSet(writer, compareResult.Duplicated, true);
                writer.WriteLine();
            }

            if (compareResult.NonMatchingValue.Count > 0)
            {
                writer.WriteLine("  Non matching value rows:");
                writer.WriteLine();
                FormatResultSet(writer, compareResult.NonMatchingValue, true);
                writer.WriteLine();
            }
        }
コード例 #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteDescriptionTo(NUnitCtr.MessageWriter writer)
        {
            var sb = new System.Text.StringBuilder();

            sb.AppendLine("Execution of the query is slower than expected");
            sb.AppendFormat("Maximum expected was {0}ms", maxTimeMilliSeconds);
            writer.WritePredicate(sb.ToString());
        }
コード例 #19
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     this.actual = "Found " + differencies.Count + " differencies between two objects";
     differencies.ForEach(s =>
     {
         writer.WriteMessageLine(s);
     });
 }
コード例 #20
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("[");
     leftConstraint.WriteDescriptionTo(writer);
     writer.WriteConnector("AND");
     rightConstraint.WriteDescriptionTo(writer);
     writer.Write("]");
 }
コード例 #21
0
ファイル: NoRowsConstraint.cs プロジェクト: jeason0813/NBi
 public override void WriteDescriptionTo(NUnitCtr.MessageWriter writer)
 {
     if (Configuration.FailureReportProfile.Format == FailureReportFormat.Json)
     {
         return;
     }
     writer.WritePredicate($"no rows validate the predicate '{filter.Describe()}'.");
 }
コード例 #22
0
 public override void WriteMessageTo(MessageWriter writer)
 {
     if (writer != null) {
         foreach (var failure in _failures) {
             failure.WriteMessageTo(writer);
         }
     }
 }
コード例 #23
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     base.WriteMessageTo(writer);
     writer.WriteLine();
     writer.WriteLine();
     WriteFilterMessageTo(writer);
     writer.WriteLine(Failure.RenderFiltered());
 }
コード例 #24
0
 public virtual void WriteFilterMessageTo(NUnitCtr.MessageWriter writer)
 {
     if (Configuration.FailureReportProfile.Format == FailureReportFormat.Json)
     {
         return;
     }
     writer.WriteLine("Filtered version of the result-set:");
 }
コード例 #25
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     writer.WritePredicate("Execution of the query doesn't match the expected result");
     writer.WriteLine();
     writer.WriteLine();
     base.WriteMessageTo(writer);
     DisplayDifferences(writer, result);
 }
コード例 #26
0
ファイル: HasCssMatcher.cs プロジェクト: MatteS75/coypu
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.WriteMessageLine("Expected to find element with css selector: {0}\nin:\n{1}", _expectedCss, _actualContent);
     if (exactText != null)
         writer.WriteMessageLine("With text: \"" + exactText + "\"");
     if (textPattern != null)
         writer.WriteMessageLine("With text matching: \"" + textPattern + "\"");
 }
コード例 #27
0
ファイル: Constraints.cs プロジェクト: SergeTruth/OxyChart
 public override void WriteMessageTo(MessageWriter writer)
 {
     if (this.actual is IMethod) {
         writer.WriteMessageLine("Expected {0} to have an empty BodyRegion but it was not empty {1}.", this.m, this.m.BodyRegion);
     } else {
         writer.WriteMessageLine("{0} is not an IMethod; cannot test for the emptiness of a it's BodyRegion.", this.actual);
     }
 }
コード例 #28
0
ファイル: NoRowsConstraint.cs プロジェクト: jeason0813/NBi
 public override void WriteFilterMessageTo(NUnitCtr.MessageWriter writer)
 {
     if (Configuration.FailureReportProfile.Format == FailureReportFormat.Json)
     {
         return;
     }
     writer.WriteLine("Rows validating the predicate:");
 }
コード例 #29
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.WriteMessageLine("Expected to find elements from css selector: {0}\r\nContaining only:\r\n", _expectedCss);
     if (exactText != null)
         writer.WriteMessageLine(string.Format("[{0}]", string.Join(",", exactText)));
     if (textPattern != null)
         writer.WriteMessageLine(string.Format("[{0}]", string.Join(",", textPattern.Select(p => p.ToString()).ToArray())));
     
 }
コード例 #30
0
ファイル: OrderedConstraint.cs プロジェクト: kalyon/NBi
 /// <summary>
 /// Write the constraint description to a MessageWriter
 /// </summary>
 /// <param name="writer">The writer on which the description is displayed</param>
 public override void WriteDescriptionTo(NUnitCtr.MessageWriter writer)
 {
     writer.WritePredicate(string.Format("On perspective \"{0}\", the {1} of \"{2}\" are ordered {3}{4}"
                                         , Request.Perspective
                                         , Request.Function.ToLower()
                                         , Request.Path
                                         , Comparer == null ? "specifically" : ((IComparerWithLabel)Comparer).Label
                                         , reversed ? "(descending)" : string.Empty));
 }
コード例 #31
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     writer.WritePredicate("Execution of the query returns duplicated rows");
     writer.WriteLine();
     writer.WriteLine();
     base.WriteMessageTo(writer);
     writer.WriteLine();
     writer.WriteLine(failure.RenderDuplicated());
 }
コード例 #32
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     writer.WritePredicate("Execution of the query doesn't match the expected result");
     writer.WriteLine();
     writer.WriteLine();
     base.WriteMessageTo(writer);
     writer.WriteLine();
     writer.WriteLine(Failure.RenderCompared());
 }
コード例 #33
0
 /// <summary>
 /// Write the actual value for a failing constraint test to a
 /// MessageWriter. The default implementation simply writes
 /// the raw value of actual, leaving it to the writer to
 /// perform any formatting.
 /// </summary>
 /// <param name="writer">The writer on which the actual value is displayed</param>
 public override void WriteActualValueTo(MessageWriter writer)
 {
     if (caughtException == null)
         writer.Write("no exception thrown");
     else if (baseConstraint != null)
         baseConstraint.WriteActualValueTo(writer);
     else
         writer.WriteActualValue(caughtException);
 }
コード例 #34
0
ファイル: SuccessfulConstraint.cs プロジェクト: ywscr/NBi
        public override void WriteDescriptionTo(NUnitCtr.MessageWriter writer)
        {
            var sb = new System.Text.StringBuilder();

            sb.AppendLine();
            sb.AppendFormat("Successful execution of the etl.");
            sb.AppendLine();
            writer.WritePredicate(sb.ToString());
        }
コード例 #35
0
 /// <summary>
 /// Writes a description of the attribute to the specified writer.
 /// </summary>
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.WritePredicate("attribute " + expectedType.FullName);
     if (baseConstraint != null)
     {
         if (baseConstraint is EqualConstraint)
             writer.WritePredicate("equal to");
         baseConstraint.WriteDescriptionTo(writer);
     }
 }
コード例 #36
0
ファイル: NoRowsConstraint.cs プロジェクト: jeason0813/NBi
        public override void WriteActualValueTo(NUnitCtr.MessageWriter writer)
        {
            if (Configuration.FailureReportProfile.Format == FailureReportFormat.Json)
            {
                return;
            }
            var value = filterResultSet.Rows.Count;

            writer.WriteLine($"{value} row{(value > 1 ? "s" : string.Empty)} validate{(value == 1 ? "s" : string.Empty)} the predicate '{filter.Describe()}'.");
        }
コード例 #37
0
 /// <summary/>
 public override void WriteMessageTo(MessageWriter writer)
 {
     writer.WriteMessageLine(GetType().FullName + " Failed!");
     using (StringReader reader = new StringReader(message.ToString()))
     {
         string line;
         while ((line = reader.ReadLine()) != null)
             writer.WriteMessageLine(line);
     }
 }
コード例 #38
0
 /// <summary>
 /// Write the constraint description to a MessageWriter
 /// </summary>
 /// <param name="writer">The writer on which the description is displayed</param>
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.WritePredicate("property " + name);
     if (baseConstraint != null)
     {
         if (baseConstraint is EqualConstraint)
             writer.WritePredicate("equal to");
         baseConstraint.WriteDescriptionTo(writer);
     }
 }
コード例 #39
0
        protected virtual void FormatResultSet(NUnitCtr.MessageWriter writer, ResultSetCompareResult.Sample sample, bool compare)
        {
            var textCreator = new ResultSetTextWriter();
            var output      = textCreator.BuildContent(sample.Rows, sample.Count, compare);

            foreach (var line in output)
            {
                writer.WriteLine(line);
            }
        }
コード例 #40
0
		public override void WriteDescriptionTo(MessageWriter writer)
		{
			writer.WritePredicate("just value");


			if (_valueConstraint is EqualConstraint)
				writer.WritePredicate("equal to");

			_valueConstraint.WriteDescriptionTo(writer);
		}
コード例 #41
0
        public override void WriteActualValueTo(MessageWriter writer)
        {
            writer.WriteLine("When called with the following arguments the method did not throw the apporpriate exception:");

            foreach (var failingCall in this.state.GetFailingCallsDescriptions())
            {
                writer.Write("            ");
                writer.WriteLine(failingCall);
            }
        }
コード例 #42
0
        public override void WriteDescriptionTo(NUnitCtr.MessageWriter writer)
        {
            if (Configuration.FailureReportProfile.Format == FailureReportFormat.Json)
            {
                return;
            }

            writer.WriteLine();
            writer.WriteLine(Failure.RenderExpected());
        }
コード例 #43
0
        /// <summary>
        /// Write the actual value for a failing constraint test to a
        /// MessageWriter. Overriden to write additional information
        /// in the case of an Exception.
        /// </summary>
        /// <param name="writer">The MessageWriter to use</param>
        public override void WriteActualValueTo(MessageWriter writer)
        {
            Exception ex = actual as Exception;
            base.WriteActualValueTo(writer);

            if (ex != null)
            {
                writer.WriteLine(" ({0})", ex.Message);
                writer.Write(ex.StackTrace);
            }
        }
コード例 #44
0
ファイル: FasterThanConstraint.cs プロジェクト: zyh329/nbi
 public override void  WriteActualValueTo(NUnitCtr.MessageWriter writer)
 {
     if (performanceResult.IsTimeOut)
     {
         writer.WriteActualValue(string.Format("query interrupted after {0}ms (timeout)", performanceResult.TimeOut));
     }
     else
     {
         writer.WriteActualValue(string.Format("{0}ms", performanceResult.TimeElapsed.TotalMilliseconds));
     }
 }
コード例 #45
0
        public override void WriteDescriptionTo(NUnitCtr.MessageWriter writer)
        {
            var sb = new System.Text.StringBuilder();

            sb.AppendLine("Query is not syntactically correct.");
            foreach (var failure in parserResult.Errors)
            {
                sb.AppendLine(failure);
            }
            writer.WritePredicate(sb.ToString());
        }
コード例 #46
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     writer.WritePredicate(string.Format("On perspective \"{0}\", {1} "
                                         , Request.Perspective
                                         , GetPredicate()));
     writer.WriteLine();
     writer.WriteLine();
     base.WriteMessageTo(writer);
     writer.WriteLine();
     writer.WriteLine(Failure.RenderAnalysis());
 }
コード例 #47
0
        protected virtual void FormatResultSet(NUnitCtr.MessageWriter writer, ResultSet resultSet)
        {
            var rows        = resultSet.Rows.Cast <DataRow>().ToList();
            var textCreator = new ResultSetTextWriter();
            var output      = textCreator.BuildContent(rows, rows.Count(), false);

            foreach (var line in output)
            {
                writer.WriteLine(line);
            }
        }
コード例 #48
0
 /// <summary>
 /// Write the actual value for a failing constraint test to a
 /// MessageWriter. The default implementation simply writes
 /// the raw value of actual, leaving it to the writer to
 /// perform any formatting.
 /// </summary>
 /// <param name="writer">The writer on which the actual value is displayed</param>
 public override void WriteActualValueTo(MessageWriter writer)
 {
     DirectoryInfo dir = actual as DirectoryInfo;
     if (dir == null)
         base.WriteActualValueTo(writer);
     else
     {
         writer.WriteActualValue(dir);
         writer.Write(" with {0} files and {1} directories", files, subdirs);
     }
 }
コード例 #49
0
ファイル: MatchPatternConstraint.cs プロジェクト: kalyon/NBi
        /// <summary>
        /// Write the constraint description to a MessageWriter
        /// </summary>
        /// <param name="writer">The writer on which the description is displayed</param>
        public override void WriteDescriptionTo(NUnitCtr.MessageWriter writer)
        {
            //writer.WriteActualValue(actual);

            writer.WritePredicate(string.Format("The formatted value of each cell matchs the"));

            if (!string.IsNullOrEmpty(regex))
            {
                writer.WritePredicate(" regex pattern ");
                writer.WritePredicate(regex);
            }
        }
コード例 #50
0
ファイル: RowCountConstraint.cs プロジェクト: jansaris/NBi
        public override void WriteDescriptionTo(NUnitCtr.MessageWriter writer)
        {
            var sb = new System.Text.StringBuilder();

            sb.Append("execution of the query returns a row-count");
            if (child is NUnitCtr.EqualConstraint)
            {
                sb.Append(" equal to");
            }
            writer.WritePredicate(sb.ToString());
            child.WriteDescriptionTo(writer);
        }
コード例 #51
0
 public override void WriteActualValueTo(MessageWriter writer)
 {
     if (!leftOk) {
         writer.WriteMessageLine("Left part of the And is false because ");
         leftConstraint.WriteActualValueTo(writer);
     } else if (!rightOk) {
         writer.WriteMessageLine("Right part of the And is false because ", leftOk);
         rightConstraint.WriteActualValueTo(writer);
     } else {
         Debug.Fail("This code should be not reached");
     }
 }
コード例 #52
0
		public override void WriteActualValueTo (MessageWriter writer)
		{
			var ex = actual as XamlParseException;
			writer.WriteActualValue ((actual == null) ? null : actual.GetType ());
			if (ex != null) {
				if (ex.XmlInfo != null && ex.XmlInfo.HasLineInfo ())
					writer.Write (" line {0}, position {1}", ex.XmlInfo.LineNumber, ex.XmlInfo.LinePosition);
				else 
					writer.Write (" no line info");
				writer.WriteLine (" ({0})", ex.Message);
				writer.Write (ex.StackTrace);
			}
		}
コード例 #53
0
        /// <summary>
        /// Write description of this constraint
        /// </summary>
        /// <param name="writer">The MessageWriter to write to</param>
        public override void WriteDescriptionTo(MessageWriter writer)
        {
			writer.WriteExpectedValue( expected );

			if ( tolerance != null )
			{
				writer.WriteConnector("+/-");
				writer.WriteExpectedValue(tolerance);
			}

			if ( this.caseInsensitive )
				writer.WriteModifier("ignoring case");
        }
コード例 #54
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     if (Configuration?.FailureReportProfile.Format == FailureReportFormat.Json)
         writer.Write(failure.RenderMessage());
     else
     {
         writer.WritePredicate("Execution of the query returns duplicated rows");
         writer.WriteLine();
         writer.WriteLine();
         base.WriteMessageTo(writer);
         writer.WriteLine();
         writer.WriteLine(failure.RenderAnalysis());
     }
 }
コード例 #55
0
ファイル: MatchPatternConstraint.cs プロジェクト: zyh329/nbi
        /// <summary>
        /// Write the constraint description to a MessageWriter
        /// </summary>
        /// <param name="writer">The writer on which the description is displayed</param>
        public override void WriteDescriptionTo(NUnitCtr.MessageWriter writer)
        {
            //writer.WriteActualValue(actual);

            writer.WritePredicate(string.Format("On perspective \"{0}\", the {1} of \"{2}\" match the"
                                                , Request.Perspective
                                                , Request.Function.ToLower()
                                                , Request.Path));
            if (!string.IsNullOrEmpty(regex))
            {
                writer.WritePredicate("regex pattern");
                writer.WritePredicate(regex);
            }
        }
コード例 #56
0
 public override void WriteActualValueTo(NUnitCtr.MessageWriter writer)
 {
     if (Configuration.FailureReportProfile.Format == FailureReportFormat.Json)
     {
         return;
     }
     if (filterResultSet.Rows.Count == 0)
     {
         writer.WriteLine($"No row validates the predicate '{filter.Describe()}'.");
     }
     else
     {
         writer.WriteLine($"{filterResultSet.Rows.Count} rows validate the predicate '{filter.Describe()}'.");
     }
 }
コード例 #57
0
ファイル: MatchPatternConstraint.cs プロジェクト: kalyon/NBi
 public override void WriteActualValueTo(NUnitCtr.MessageWriter writer)
 {
     if (invalidMembers.Count == 1)
     {
         writer.WriteMessageLine(string.Format("The element <{0}> doesn't validate this pattern", invalidMembers[0]));
     }
     else
     {
         writer.WriteMessageLine(string.Format("{0} elements don't validate this pattern:", invalidMembers.Count));
         foreach (var invalidMember in invalidMembers)
         {
             writer.WriteMessageLine(string.Format("    <{0}>", invalidMember));
         }
     }
 }
コード例 #58
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     if (Configuration.FailureReportProfile.Format == FailureReportFormat.Json)
     {
         writer.Write(Failure.RenderMessage());
     }
     else
     {
         base.WriteMessageTo(writer);
         writer.WriteLine();
         writer.WriteLine();
         WriteFilterMessageTo(writer);
         writer.WriteLine(Failure.RenderAnalysis());
     }
 }
コード例 #59
0
 public override void WriteActualValueTo(NUnitCtr.MessageWriter writer)
 {
     if (actual is MemberResult && ((MemberResult)actual).Count() > 0 && ((MemberResult)actual).Count() <= 15)
     {
         writer.WriteActualValue((IEnumerable)actual);
     }
     else if (actual is MemberResult && ((MemberResult)actual).Count() > 0 && ((MemberResult)actual).Count() > 15)
     {
         writer.WriteActualValue(((IEnumerable <NBi.Core.Analysis.Member.Member>)actual).Take(10));
         writer.WriteActualValue(string.Format(" ... and {0} others.", ((MemberResult)actual).Count() - 10));
     }
     else
     {
         writer.WriteActualValue(new NothingFoundMessage());
     }
 }
コード例 #60
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     if (Configuration.FailureReportProfile.Format == FailureReportFormat.Json)
     {
         writer.Write(Failure.RenderMessage());
     }
     else
     {
         writer.WritePredicate("Score is not sufficient.");
         writer.WriteLine();
         writer.WriteLine();
         base.WriteMessageTo(writer);
         writer.WriteLine();
         writer.WriteLine(Failure.RenderMessage());
     }
 }