本文整理汇总了C#中NUnit.Framework.Constraints.MessageWriter.WritePredicate方法的典型用法代码示例。如果您正苦于以下问题:C# MessageWriter.WritePredicate方法的具体用法?C# MessageWriter.WritePredicate怎么用?C# MessageWriter.WritePredicate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NUnit.Framework.Constraints.MessageWriter
的用法示例。
在下文中一共展示了MessageWriter.WritePredicate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteDescriptionTo
/// <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));
}
}
示例2: WriteDescriptionTo
/// <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);
}
}
示例3: 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.WritePredicate("property " + name);
if (baseConstraint != null)
{
if (baseConstraint is EqualConstraint)
writer.WritePredicate("equal to");
baseConstraint.WriteDescriptionTo(writer);
}
}
示例4: WriteDescriptionTo
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("just value");
if (_valueConstraint is EqualConstraint)
writer.WritePredicate("equal to");
_valueConstraint.WriteDescriptionTo(writer);
}
示例5: 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 (baseConstraint == null)
writer.WritePredicate("an exception");
else
baseConstraint.WriteDescriptionTo(writer);
}
示例6: 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.WritePredicate("String matching");
writer.WriteExpectedValue(this.expected);
if (this.caseInsensitive)
writer.WriteModifier("ignoring case");
}
示例7: WriteDescriptionTo
/// <summary>
/// Write a description of this constraint to a MessageWriter
/// </summary>
/// <param name="writer"></param>
public override void WriteDescriptionTo(MessageWriter writer)
{
switch(expectedCount)
{
case 0:
writer.WritePredicate("no item");
break;
case 1:
writer.WritePredicate("exactly one item");
break;
default:
writer.WritePredicate("exactly " + expectedCount.ToString() + " items");
break;
}
baseConstraint.WriteDescriptionTo(writer);
}
示例8: WriteDescriptionTo
/// <summary>
/// Write a description of the constraint to a MessageWriter
/// </summary>
/// <param name="writer"></param>
public override void WriteDescriptionTo(MessageWriter writer)
{
if (Command != null)
{
var description = new DescriptionStructureHelper();
var filterExpression = description.GetFilterExpression(Command.Description.Filters);
var nextTargetExpression = description.GetNextTargetPluralExpression(Command.Description.Target);
var expectationExpression = new StringBuilder();
foreach (string item in Expected)
expectationExpression.AppendFormat("<{0}>, ", item);
expectationExpression.Remove(expectationExpression.Length - 2, 2);
writer.WritePredicate(string.Format("All {0} are defined in the set '{1}' for {2}",
nextTargetExpression,
expectationExpression.ToString(),
filterExpression));
}
}
示例9: WriteDescriptionTo
/// <summary>
/// Write a description of the constraint to a MessageWriter
/// </summary>
/// <param name="writer"></param>
public override void WriteDescriptionTo(MessageWriter writer)
{
if (Request != null)
{
var description = new DescriptionStructureHelper();
var filterExpression = description.GetFilterExpression(Request.GetAllFilters());
var nextTargetExpression = description.GetTargetPluralExpression(Request.Target);
var expectationExpression = new StringBuilder();
foreach (string item in Expected)
expectationExpression.AppendFormat("<{0}>, ", item);
expectationExpression.Remove(expectationExpression.Length - 2, 2);
writer.WritePredicate(string.Format("find an exact list of {0} named '{1}' contained {2}",
nextTargetExpression,
expectationExpression,
filterExpression));
}
}
示例10: WriteDescriptionTo
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("A fake object wrapper.");
}
示例11: WriteDescriptionTo
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("build target description depending on ");
writer.WriteExpectedValue(_dependency);
}
示例12: WriteDescriptionTo
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("dictionary containing key ");
writer.WriteExpectedValue(expected);
}
开发者ID:serilog-trace-listener,项目名称:serilog-tests-support,代码行数:5,代码来源:DictionaryContainsKeyConstraint.cs
示例13: WriteDescriptionTo
/// <summary>
/// Write a description of this constraint to a MessageWriter
/// </summary>
/// <param name="writer"></param>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate( "subset of" );
writer.WriteExpectedValue(expected);
}
示例14: WriteDescriptionTo
/// <summary>
/// Write a description of the constraint to a MessageWriter
/// </summary>
/// <param name="writer"></param>
public override void WriteDescriptionTo(MessageWriter writer)
{
var description = new DescriptionDataTypeHelper();
var filterExpression = description.GetFilterExpression(Command.Description.Filters.Where(f => f.Target != Command.Description.Target));
var targetExpression = description.GetTargetExpression(Command.Description.Target);
var captionExpression = Command.Description.Filters.Single(f => f.Target == Command.Description.Target).Caption;
writer.WritePredicate(string.Format("the type of {0} '{1}' ({2}) is '{3}'"
, targetExpression
, captionExpression
, filterExpression
, expected.ToString()));
}
示例15: WriteDescriptionTo
/// <summary>
/// Write a description of this constraint to a MessageWriter
/// </summary>
/// <param name="writer">The MessageWriter to use</param>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("instance of");
writer.WriteExpectedValue(expectedType);
}