本文整理汇总了C#中NUnit.Framework.Constraints.MessageWriter.Write方法的典型用法代码示例。如果您正苦于以下问题:C# MessageWriter.Write方法的具体用法?C# MessageWriter.Write怎么用?C# MessageWriter.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NUnit.Framework.Constraints.MessageWriter
的用法示例。
在下文中一共展示了MessageWriter.Write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteDescriptionTo
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.Write("[");
leftConstraint.WriteDescriptionTo(writer);
writer.WriteConnector("AND");
rightConstraint.WriteDescriptionTo(writer);
writer.Write("]");
}
示例2: WriteMessageTo
public override void WriteMessageTo(MessageWriter writer)
{
if (leftConstraint is BinaryOperator)
leftConstraint.WriteMessageTo(writer);
else
writer.Write("false ");
writer.Write("OR");
if (rightConstraint is BinaryOperator)
rightConstraint.WriteMessageTo(writer);
else
writer.Write("false ");
base.WriteMessageTo(writer);
}
示例3: WriteActualValueTo
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);
}
}
示例4: WriteDescriptionTo
/// <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>");
}
示例5: WriteActualValueTo
public override void WriteActualValueTo(MessageWriter writer)
{
writer.WriteActualValue(" found count (" + MatchCount.ToString() + ")");
writer.Write("[");
baseConstraint.WriteDescriptionTo(writer);
writer.WriteMessageLine("] expected count of {0}", countOccurrence );
}
示例6: WriteMessageTo
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);
}
}
示例7: WriteActualValueTo
/// <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);
}
示例8: WriteActualValueTo
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);
}
}
示例9: WriteActual
/// <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);
}
}
示例10: WriteActualValueTo
/// <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);
}
}
示例11: WriteActualValueTo
/// <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);
}
}
示例12: WriteDescriptionTo
public override void WriteDescriptionTo(MessageWriter writer)
{
if (!this.comparisonResults.Any())
return;
var sb = new StringBuilder();
foreach (var result in this.comparisonResults)
{
var difference = result.Differences.Single();
sb.AppendFormat("{0} between: {1} and: {2}\n",
result.DifferencesString, difference.ParentObject1.Target, difference.ParentObject2.Target);
}
writer.Write("Items in collection are not same. Please inspect differences:\n\n{0}", sb);
}
示例13: WriteDescriptionTo
/// <summary>
/// Write a description of this constraint to a MessageWriter
/// </summary>
/// <param name="writer"></param>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.Write("all items unique");
}
示例14: WriteDescriptionTo
/// <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.Write( "An empty directory" );
}
示例15: WriteDescriptionTo
/// <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.Write(string.Format("No Exception to be thrown"));
}