public abstract WriteActualValue ( object actual ) : void | ||
actual | object | The actual value. |
return | void |
/// <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() ); }
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); } } }
/// <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()); } }
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)); } }
public override void WriteActualValueTo(MessageWriter writer) { var headers = actual as HttpHeaders; if (headers != null) { writer.WriteActualValue( headers.Select(header => new KeyValuePair<string, string>(header.Key, string.Join(", ", header.Value)))); } else { writer.WriteActualValue(actual); } }
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()); }
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 == null) writer.WriteActualValue(new WriterHelper.NothingFoundMessage()); else { var result = Actual.Name; result += expected is ILength && Actual is ILength && ((ILength)expected).Length.HasValue ? "(" + ((ILength)Actual).Length.Value : ""; result += expected is IPrecision && Actual is IPrecision && ((IPrecision)expected).Precision.HasValue ? "(" + ((IPrecision)Actual).Precision.Value : ""; result += expected is IScale && Actual is IScale && ((IScale)expected).Scale.HasValue ? "," + ((IScale)Actual).Scale.Value : ""; result += result.Contains("(") ? ")" : ""; writer.WriteActualValue(result); } }
public override void WriteActualValueTo(MessageWriter writer) { writer.WriteActualValue(" found count (" + MatchCount.ToString() + ")"); writer.Write("["); baseConstraint.WriteDescriptionTo(writer); writer.WriteMessageLine("] expected count of {0}", countOccurrence ); }
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()); } }
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<string>)) return; var isApproximate = false; foreach (var actualItem in (actual as IEnumerable<string>)) { var text = string.Empty; if (actualItem.ToLowerInvariant() == Expected.ToLowerInvariant()) text = string.Format("< <{0}> > (case not matching)", actualItem); else if (actualItem.TrimEnd() == Expected) text = string.Format("< <{0}> > (with ending space(s))", actualItem); else if (actualItem.TrimStart() == Expected) text = string.Format("< <{0}> > (with leading space(s))", actualItem); else if (actualItem.ToLowerInvariant().Trim() == Expected.ToLowerInvariant().Trim()) text = string.Format("< <{0}> > (small difference)", actualItem); if (!string.IsNullOrEmpty(text)) { writer.WriteActualValue(text); isApproximate = true; } } if (!isApproximate) { if (((IEnumerable<string>)actual).Count() == 0) writer.WriteActualValue(new WriterHelper.NothingFoundMessage()); else { base.WriteActualValueTo(writer); 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); } } } }
/// <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); }
/// <summary> /// Writes the value of the actual object. /// </summary> public void WriteActual(MessageWriter writer) { if (Actual is IMissingMember) { writer.Write("member was missing"); } else if (Actual is IMissingElement) { writer.Write("element was missing"); } else if (Actual is IUnexpectedElement) { writer.WriteActualValue(((IUnexpectedElement)Actual).Element); } else { writer.WriteActualValue(Actual); } }
/// <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); } }
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); } }
public override void WriteActualValueTo(MessageWriter writer) { if (this.Status == ConstraintStatus.Failure) { if (caughtException is Exception ex) { writer.WriteActualValue(ex); } else { base.WriteActualValueTo(writer); } } }
/// <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); } }
/// <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); } }
/// <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 " , Request.Perspective , Request.Function.ToLower() , Request.Path)); if (exactly.HasValue) { writer.WritePredicate("exactly"); writer.WriteExpectedValue(exactly.Value); return; } if (moreThan.HasValue && lessThan.HasValue) { writer.WritePredicate("between"); writer.WriteExpectedValue(moreThan.Value); writer.WriteConnector("and"); writer.WriteExpectedValue(lessThan.Value); return; } if (moreThan.HasValue) { writer.WritePredicate("more than"); writer.WriteExpectedValue(moreThan.Value); return; } if (lessThan.HasValue) { writer.WritePredicate("less than"); writer.WriteExpectedValue(lessThan.Value); return; } writer.WriteActualValue(((ICollection)actual).Count); }
public override void WriteActualValueTo(MessageWriter writer) { //actual is equal to the List of Dimensions/Measure-Group effectively linkedTo, so we don't need to perform an investigation. ////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()); //} }
/// <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 virtual void WriteActualValueTo(MessageWriter writer) { writer.WriteActualValue(actual); }
/// <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) { writer.WriteActualValue(propValue); }
/// <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) { writer.WriteActualValue( this.caughtException.GetType() ); }
/// <summary> /// Writes the actual value supplied to the specified writer. /// </summary> public override void WriteActualValueTo(MessageWriter writer) { writer.WriteActualValue(attrFound); }
/// <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) { writer.WriteActualValue(propValue); }
public override void WriteActualValueTo(MessageWriter writer) { XmlElement element; if (TryGetElement(actual, out element)) writer.WriteActualValue(element.OuterXml); else base.WriteActualValueTo(writer); }
/// <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) { writer.WriteActualValue(this.caughtException.GetType()); }
/// <summary> /// Writes the actual value supplied to the specified writer. /// </summary> public override void WriteActualValueTo(MessageWriter writer) { writer.WriteActualValue(attrFound); }
public override void WriteActualValueTo(NUnitCtr.MessageWriter writer) { writer.WriteActualValue(TransformDecimalToPercentage(ctr.WriteActualValueTo)); }
public override void WriteActualValueTo(NUnitCtr.MessageWriter writer) { writer.WriteActualValue("deprecated feature!"); }
public override void WriteActualValueTo(NUnitCtr.MessageWriter writer) { writer.WriteActualValue(string.Format("{0}ms", Result.TimeElapsed.TotalMilliseconds)); }
/// <summary> /// Write the actual value for a failing constraint test to a /// MessageWriter. /// </summary> /// <param name="writer">The writer on which the actual value is displayed</param> public override void WriteActualValueTo(MessageWriter writer) { writer.WriteActualValue(actualType); }
/// <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 virtual void WriteActualValueTo(MessageWriter writer) { writer.WriteActualValue( actual ); }
public override void WriteActualValueTo(NUnitCtr.MessageWriter writer) { writer.WriteActualValue(string.Format("Failure during execution of the etl: {0}", Result.Message)); }
/// <summary> /// Write the actual value for a failing constraint test to a /// MessageWriter. /// </summary> /// <param name="writer">The writer on which the actual value is displayed</param> public override void WriteActualValueTo(MessageWriter writer) { writer.WriteActualValue(actualType); }
public override void WriteDescriptionTo(MessageWriter writer) { if (actual == null) { writer.WriteMessageLine("Actual value does not have a meta table."); } else if (_typeMismatch) { writer.WriteMessageLine("Meta entry type doesn't match."); writer.WriteExpectedValue(_expectedEntry.EntryType); writer.WriteActualValue(_actualEntry.EntryType); } else { writer.WriteMessageLine( "actual meta entry {0} should match expected entry {1}", _actualEntry, _expectedEntry); } }
/// <summary> /// Write the actual value for a failing constraint test to a /// MessageWriter. TypeConstraints override this method to write /// the name of the type. /// </summary> /// <param name="writer">The writer on which the actual value is displayed</param> public override void WriteActualValueTo(MessageWriter writer) { writer.WriteActualValue( actual == null ? null : actual.GetType() ); }
/// <summary> /// Write the actual value for a failing constraint test to a /// MessageWriter. TypeConstraints override this method to write /// the name of the type. /// </summary> /// <param name="writer">The writer on which the actual value is displayed</param> public override void WriteActualValueTo(MessageWriter writer) { writer.WriteActualValue(actual == null ? null : actual.GetType()); }