当前位置: 首页>>代码示例>>C#>>正文


C# Constraints.MessageWriter类代码示例

本文整理汇总了C#中NUnit.Framework.Constraints.MessageWriter的典型用法代码示例。如果您正苦于以下问题:C# MessageWriter类的具体用法?C# MessageWriter怎么用?C# MessageWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MessageWriter类属于NUnit.Framework.Constraints命名空间,在下文中一共展示了MessageWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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 );
 }
开发者ID:mbsky,项目名称:dotnetmarcheproject,代码行数:7,代码来源:CountItemConstraint.cs

示例2: 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));
            }
        }
开发者ID:zyh329,项目名称:nbi,代码行数:29,代码来源:ContainConstraint.cs

示例3: WriteFailureMessageTo

 protected override void WriteFailureMessageTo(MessageWriter writer)
 {
     if (caseInsensitive)
         writer.WriteMessageLine(msg_DoesNotContain_IC);
     else
         writer.WriteMessageLine(msg_DoesNotContain);
 }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:7,代码来源:StringConstraints.cs

示例4: WriteDescriptionTo

 public override void WriteDescriptionTo(MessageWriter writer)
 {
     //WritePredicateTo(writer);
     writer.WriteExpectedValue(expected);
     //if (ignoreCase)
     //    writer.Write(" ignoring case");
 }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:7,代码来源:StringConstraints.cs

示例5: 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);
 }
开发者ID:mbsky,项目名称:dotnetmarcheproject,代码行数:7,代码来源:OrOperator.cs

示例6: 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);
			}
		}
开发者ID:pusp,项目名称:o2platform,代码行数:7,代码来源:Constraints.cs

示例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 ( propertyExists )
				writer.WriteActualValue( propValue );
			else
				writer.WriteActualValue( actual.GetType() );
		}
开发者ID:Xarlot,项目名称:Xunit.StaFact,代码行数:14,代码来源:PropertyConstraint.cs

示例8: 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);
 }
开发者ID:rmterra,项目名称:AutoTest.Net,代码行数:11,代码来源:ThrowsConstraint.cs

示例9: WriteActualValueTo

 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());
 }
开发者ID:zyh329,项目名称:nbi,代码行数:7,代码来源:AbstractCollectionConstraint.cs

示例10: 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<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);
                }
            }
        }
开发者ID:zyh329,项目名称:nbi,代码行数:32,代码来源:ExistsConstraint.cs

示例11: 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");
 }
开发者ID:pjcollins,项目名称:Andr.Unit,代码行数:11,代码来源:RegexConstraint.cs

示例12: 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);
            }
        }
开发者ID:Yarmonov,项目名称:yarmonov.pro,代码行数:35,代码来源:TwinConstraintResult.cs

示例13: 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>");
 }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:11,代码来源:EmptyConstraint.cs

示例14: WriteDescriptionTo

 public override void WriteDescriptionTo(MessageWriter writer)
 {
     this.actual = "Found " + differencies.Count + " differencies between two objects";
     differencies.ForEach(s =>
     {
         writer.WriteMessageLine(s);
     });
 }
开发者ID:mbsky,项目名称:dotnetmarcheproject,代码行数:8,代码来源:ObjectEqualConstraint.cs

示例15: WriteDescriptionTo

 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("[");
     leftConstraint.WriteDescriptionTo(writer);
     writer.WriteConnector("AND");
     rightConstraint.WriteDescriptionTo(writer);
     writer.Write("]");
 }
开发者ID:mbsky,项目名称:dotnetmarcheproject,代码行数:8,代码来源:AndOperator.cs


注:本文中的NUnit.Framework.Constraints.MessageWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。