本文整理汇总了C#中NUnit.Framework.Constraints.MessageWriter.WriteMessageLine方法的典型用法代码示例。如果您正苦于以下问题:C# MessageWriter.WriteMessageLine方法的具体用法?C# MessageWriter.WriteMessageLine怎么用?C# MessageWriter.WriteMessageLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NUnit.Framework.Constraints.MessageWriter
的用法示例。
在下文中一共展示了MessageWriter.WriteMessageLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteFailureMessageTo
protected override void WriteFailureMessageTo(MessageWriter writer)
{
if (caseInsensitive)
writer.WriteMessageLine(msg_DoesNotContain_IC);
else
writer.WriteMessageLine(msg_DoesNotContain);
}
示例2: WriteActualValueTo
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);
}
示例3: WriteMessageTo
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);
}
}
示例4: WriteMessageTo
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);
}
}
示例5: WriteDescriptionTo
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 + "\"");
}
示例6: WriteDescriptionTo
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())));
}
示例7: WriteMessageTo
/// <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);
}
}
示例8: WriteActualValueTo
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");
}
}
示例9: WriteMessageTo
public override void WriteMessageTo(MessageWriter writer)
{
if (_expectedLine == null)
{
writer.WriteMessageLine("Expected end of string (null), actual was '{0}'", _actualLine);
return;
}
if (_actualLine == null)
{
writer.WriteMessageLine("Expected string '{0}', actual was at end (null)", _expectedLine);
return;
}
writer.DisplayStringDifferences(_expectedLine, _actualLine, 0, false, true);
}
示例10: 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 );
}
示例11: WriteDescriptionTo
public override void WriteDescriptionTo(MessageWriter writer)
{
this.actual = "Found " + differencies.Count + " differencies between two objects";
differencies.ForEach(s =>
{
writer.WriteMessageLine(s);
});
}
示例12: WriteActualValueTo
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);
}
}
}
}
示例13: DisplayFailurePoint
/// <summary>
/// Displays a single line showing the point in the expected and actual
/// arrays at which the comparison failed. If the arrays have different
/// structures or dimensions, both values are shown.
/// </summary>
/// <param name="writer">The MessageWriter on which to display</param>
/// <param name="expected">The expected array</param>
/// <param name="actual">The actual array</param>
/// <param name="failurePoint">Index of the failure point in the underlying collections</param>
/// <param name="indent">The indentation level for the message line</param>
private void DisplayFailurePoint(MessageWriter writer, ICollection expected, ICollection actual, int failurePoint, int indent)
{
Array expectedArray = expected as Array;
Array actualArray = actual as Array;
int expectedRank = expectedArray != null ? expectedArray.Rank : 1;
int actualRank = actualArray != null ? actualArray.Rank : 1;
bool useOneIndex = expectedRank == actualRank;
if (expectedArray != null && actualArray != null)
for (int r = 1; r < expectedRank && useOneIndex; r++)
if (expectedArray.GetLength(r) != actualArray.GetLength(r))
useOneIndex = false;
int[] expectedIndices = MsgUtils.GetArrayIndicesFromCollectionIndex(expected, failurePoint);
if (useOneIndex)
{
writer.WriteMessageLine(indent, ValuesDiffer_1, MsgUtils.GetArrayIndicesAsString(expectedIndices));
}
else
{
int[] actualIndices = MsgUtils.GetArrayIndicesFromCollectionIndex(actual, failurePoint);
writer.WriteMessageLine(indent, ValuesDiffer_2,
MsgUtils.GetArrayIndicesAsString(expectedIndices), MsgUtils.GetArrayIndicesAsString(actualIndices));
}
}
示例14: WriteDescriptionTo
override void WriteDescriptionTo(MessageWriter writer)
{
writer.WriteMessageLine(
"meta table of object {0} should contain an entry for key \"{1}\"", actual, _key);
}
示例15: DisplayStreamDifferences
private void DisplayStreamDifferences(MessageWriter writer, Stream expected, Stream actual, int depth)
{
if (expected.Length == actual.Length)
{
long offset = (long)failurePoints[depth];
writer.WriteMessageLine(StreamsDiffer_1, expected.Length, offset);
}
else
writer.WriteMessageLine(StreamsDiffer_2, expected.Length, actual.Length);
}