WriteActualValue() public abstract method

Writes the text for an actual value.
public abstract WriteActualValue ( object actual ) : void
actual object The actual value.
return void
		/// <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() );
		}
Beispiel #2
0
        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);
                }
            }
        }
Beispiel #3
0
 /// <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());
     }
 }
Beispiel #4
0
 public override void  WriteActualValueTo(NUnitCtr.MessageWriter writer)
 {
     if (performanceResult.IsTimeOut)
     {
         writer.WriteActualValue(string.Format("query interrupted after {0}ms (timeout)", performanceResult.TimeOut));
     }
     else
     {
         writer.WriteActualValue(string.Format("{0}ms", performanceResult.TimeElapsed.TotalMilliseconds));
     }
 }
        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);
            }
        }
 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());
 }
Beispiel #7
0
        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);
            }
        }
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteActualValue(" found count (" + MatchCount.ToString() + ")");
     writer.Write("[");
     baseConstraint.WriteDescriptionTo(writer);
     writer.WriteMessageLine("] expected count of {0}", countOccurrence );
 }
 public override void WriteActualValueTo(NUnitCtr.MessageWriter writer)
 {
     if (actual is MemberResult && ((MemberResult)actual).Count() > 0 && ((MemberResult)actual).Count() <= 15)
     {
         writer.WriteActualValue((IEnumerable)actual);
     }
     else if (actual is MemberResult && ((MemberResult)actual).Count() > 0 && ((MemberResult)actual).Count() > 15)
     {
         writer.WriteActualValue(((IEnumerable <NBi.Core.Analysis.Member.Member>)actual).Take(10));
         writer.WriteActualValue(string.Format(" ... and {0} others.", ((MemberResult)actual).Count() - 10));
     }
     else
     {
         writer.WriteActualValue(new NothingFoundMessage());
     }
 }
Beispiel #10
0
        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);
                    }
                }
            }
        }
 /// <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);
 }
 /// <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);
     }
 }
 /// <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);
     }
 }
		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);
			}
		}
 public override void WriteActualValueTo(MessageWriter writer)
 {
     if (this.Status == ConstraintStatus.Failure)
     {
         if (caughtException is Exception ex)
         {
             writer.WriteActualValue(ex);
         }
         else
         {
             base.WriteActualValueTo(writer);
         }
     }
 }
Beispiel #16
0
        /// <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);
            }
        }
 /// <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);
     }
 }
Beispiel #18
0
        /// <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(NUnitCtr.MessageWriter writer)
        {
            writer.WritePredicate(string.Format("On perspective \"{0}\", the {1} of \"{2}\" are "
                                                , Request.Perspective
                                                , Request.Function.ToLower()
                                                , Request.Path));
            if (exactly.HasValue)
            {
                writer.WritePredicate("exactly");
                writer.WriteExpectedValue(exactly.Value);
                return;
            }

            if (moreThan.HasValue && lessThan.HasValue)
            {
                writer.WritePredicate("between");
                writer.WriteExpectedValue(moreThan.Value);
                writer.WriteConnector("and");
                writer.WriteExpectedValue(lessThan.Value);
                return;
            }

            if (moreThan.HasValue)
            {
                writer.WritePredicate("more than");
                writer.WriteExpectedValue(moreThan.Value);
                return;
            }

            if (lessThan.HasValue)
            {
                writer.WritePredicate("less than");
                writer.WriteExpectedValue(lessThan.Value);
                return;
            }

            writer.WriteActualValue(((ICollection)actual).Count);
        }
Beispiel #19
0
        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());
            //}
        }
 /// <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);
 }
Beispiel #21
0
 /// <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)
 {
     writer.WriteActualValue(propValue);
 }
Beispiel #22
0
        /// <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)
		{
			writer.WriteActualValue( this.caughtException.GetType() );
		}
Beispiel #23
0
 /// <summary>
 /// Writes the actual value supplied to the specified writer.
 /// </summary>
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteActualValue(attrFound);
 }
Beispiel #24
0
 /// <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)
 {
     writer.WriteActualValue(propValue);
 }
Beispiel #25
0
		public override void WriteActualValueTo(MessageWriter writer)
		{
			XmlElement element;
			if (TryGetElement(actual, out element))
				writer.WriteActualValue(element.OuterXml);
			else
				base.WriteActualValueTo(writer);
		}
 /// <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)
 {
     writer.WriteActualValue(this.caughtException.GetType());
 }
 /// <summary>
 /// Writes the actual value supplied to the specified writer.
 /// </summary>
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteActualValue(attrFound);
 }
 public override void WriteActualValueTo(NUnitCtr.MessageWriter writer)
 {
     writer.WriteActualValue(TransformDecimalToPercentage(ctr.WriteActualValueTo));
 }
Beispiel #29
0
 public override void WriteActualValueTo(NUnitCtr.MessageWriter writer)
 {
     writer.WriteActualValue("deprecated feature!");
 }
Beispiel #30
0
 public override void  WriteActualValueTo(NUnitCtr.MessageWriter writer)
 {
     writer.WriteActualValue(string.Format("{0}ms", Result.TimeElapsed.TotalMilliseconds));
 }
Beispiel #31
0
 /// <summary>
 /// Write the actual value for a failing constraint test to a
 /// MessageWriter.
 /// </summary>
 /// <param name="writer">The writer on which the actual value is displayed</param>
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteActualValue(actualType);
 }
Beispiel #32
0
		/// <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 );
		}
Beispiel #33
0
 public override void WriteActualValueTo(NUnitCtr.MessageWriter writer)
 {
     writer.WriteActualValue(string.Format("Failure during execution of the etl: {0}", Result.Message));
 }
 /// <summary>
 /// Write the actual value for a failing constraint test to a
 /// MessageWriter.
 /// </summary>
 /// <param name="writer">The writer on which the actual value is displayed</param>
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteActualValue(actualType);
 }
Beispiel #35
0
 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);
     }
 }
Beispiel #36
0
 /// <summary>
 /// Write the actual value for a failing constraint test to a
 /// MessageWriter. TypeConstraints override this method to write
 /// the name of the type.
 /// </summary>
 /// <param name="writer">The writer on which the actual value is displayed</param>
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteActualValue( actual == null ? null : actual.GetType() );
 }
Beispiel #37
0
 /// <summary>
 /// Write the actual value for a failing constraint test to a
 /// MessageWriter. TypeConstraints override this method to write
 /// the name of the type.
 /// </summary>
 /// <param name="writer">The writer on which the actual value is displayed</param>
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteActualValue(actual == null ? null : actual.GetType());
 }