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


C# MessageWriter.WriteActualValue方法代码示例

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


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

示例1: 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

示例2: 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

示例3: WriteActualValueTo

        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);
            }
        }
开发者ID:vtex,项目名称:workspaces-client-net,代码行数:15,代码来源:HeadersContainItemsConstraint.cs

示例4: 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

示例5: 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

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

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

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

示例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);
     }
 }
开发者ID:dgg,项目名称:testing-commons,代码行数:22,代码来源:WritableEqualityResult.cs

示例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);
     }
 }
开发者ID:gezidan,项目名称:ZYSOCKET,代码行数:18,代码来源:EmptyDirectoryConstraint.cs

示例11: 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);
			}
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:13,代码来源:XamlParseExceptionConstraint.cs

示例12: WriteActualValueTo

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

示例13: 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 virtual void WriteActualValueTo(MessageWriter writer)
		{
			writer.WriteActualValue( actual );
		}
开发者ID:Xarlot,项目名称:Xunit.StaFact,代码行数:11,代码来源:Constraint.cs

示例14: WriteDescriptionTo

 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);
     }
 }
开发者ID:SealedSun,项目名称:prx,代码行数:19,代码来源:Meta.cs

示例15: WriteActualValueTo

 /// <summary>
 /// Writes the actual value supplied to the specified writer.
 /// </summary>
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteActualValue(attrFound);
 }
开发者ID:Phaiax,项目名称:dotnetautoupdate,代码行数:7,代码来源:AttributeConstraints.cs


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