Exemplo n.º 1
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("[");
     leftConstraint.WriteDescriptionTo(writer);
     writer.WriteConnector("AND");
     rightConstraint.WriteDescriptionTo(writer);
     writer.Write("]");
 }
		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);
			}
		}
Exemplo n.º 3
0
 public override void WriteMessageTo(MessageWriter writer)
 {
     if (leftConstraint is BinaryOperator)
         leftConstraint.WriteMessageTo(writer);
     else
         writer.Write("false ");
     writer.Write("OR");
     if (rightConstraint is BinaryOperator)
         rightConstraint.WriteMessageTo(writer);
     else
         writer.Write("false ");
     base.WriteMessageTo(writer);
 }
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteActualValue(" found count (" + MatchCount.ToString() + ")");
     writer.Write("[");
     baseConstraint.WriteDescriptionTo(writer);
     writer.WriteMessageLine("] expected count of {0}", countOccurrence );
 }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 6
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(MessageWriter writer)
 {
     //if (actual is string)
     //    writer.WriteExpected(string.Empty);
     //else
         writer.Write("<empty>");
 }
Exemplo n.º 7
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 (caughtException == null)
         writer.Write("no exception thrown");
     else if (baseConstraint != null)
         baseConstraint.WriteActualValueTo(writer);
     else
         writer.WriteActualValue(caughtException);
 }
Exemplo n.º 8
0
 /// <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);
     }
 }
        public override void WriteActualValueTo(MessageWriter writer)
        {
            writer.WriteLine("When called with the following arguments the method did not throw the apporpriate exception:");

            foreach (var failingCall in this.state.GetFailingCallsDescriptions())
            {
                writer.Write("            ");
                writer.WriteLine(failingCall);
            }
        }
 /// <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. Overriden to write additional information
        /// in the case of an Exception.
        /// </summary>
        /// <param name="writer">The MessageWriter to use</param>
        public override void WriteActualValueTo(MessageWriter writer)
        {
            Exception ex = actual as Exception;
            base.WriteActualValueTo(writer);

            if (ex != null)
            {
                writer.WriteLine(" ({0})", ex.Message);
                writer.Write(ex.StackTrace);
            }
        }
Exemplo n.º 12
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     if (Configuration?.FailureReportProfile.Format == FailureReportFormat.Json)
         writer.Write(failure.RenderMessage());
     else
     {
         writer.WritePredicate("Execution of the query returns duplicated rows");
         writer.WriteLine();
         writer.WriteLine();
         base.WriteMessageTo(writer);
         writer.WriteLine();
         writer.WriteLine(failure.RenderAnalysis());
     }
 }
Exemplo n.º 13
0
 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);
     }
 }
Exemplo n.º 14
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     if (Configuration.FailureReportProfile.Format == FailureReportFormat.Json)
     {
         writer.Write(Failure.RenderMessage());
     }
     else
     {
         base.WriteMessageTo(writer);
         writer.WriteLine();
         writer.WriteLine();
         WriteFilterMessageTo(writer);
         writer.WriteLine(Failure.RenderAnalysis());
     }
 }
Exemplo n.º 15
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     if (Configuration.FailureReportProfile.Format == FailureReportFormat.Json)
     {
         writer.Write(Failure.RenderMessage());
     }
     else
     {
         writer.WritePredicate("Execution of the query doesn't match the expected result");
         writer.WriteLine();
         writer.WriteLine();
         base.WriteMessageTo(writer);
         writer.WriteLine();
         writer.WriteLine(Failure.RenderAnalysis());
     }
 }
Exemplo n.º 16
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     if (propertyName == null)
     {
         writer.Write("collection ordered");
     }
     else
     {
         writer.WritePredicate("collection ordered by");
         writer.WriteExpectedValue(propertyName);
     }
     if (descending)
     {
         writer.WriteModifier("descending");
     }
 }
Exemplo n.º 17
0
        public override void WriteDescriptionTo(MessageWriter writer)
        {
            if (!this.comparisonResults.Any())
                return;

            var sb = new StringBuilder();
            foreach (var result in this.comparisonResults)
            {
                var difference = result.Differences.Single();

                sb.AppendFormat("{0} between: {1} and: {2}\n",
                    result.DifferencesString, difference.ParentObject1.Target, difference.ParentObject2.Target);
            }

            writer.Write("Items in collection are not same. Please inspect differences:\n\n{0}", sb);
        }
Exemplo n.º 18
0
 public override void WriteMessageTo(NUnitCtr.MessageWriter writer)
 {
     if (Configuration.FailureReportProfile.Format == FailureReportFormat.Json)
     {
         writer.Write(Failure.RenderMessage());
     }
     else
     {
         writer.WritePredicate("Score is not sufficient.");
         writer.WriteLine();
         writer.WriteLine();
         base.WriteMessageTo(writer);
         writer.WriteLine();
         writer.WriteLine(Failure.RenderMessage());
     }
 }
Exemplo n.º 19
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.WriteExpectedValue(expected);
     if (tolerance != null && !tolerance.IsEmpty)
     {
         writer.WriteConnector("+/-");
         writer.WriteExpectedValue(tolerance.Value);
         if (tolerance.Mode != ToleranceMode.Linear)
         {
             writer.Write(" {0}", tolerance.Mode);
         }
     }
     if (comparer.IgnoreCase)
     {
         writer.WriteModifier("ignoring case");
     }
 }
Exemplo n.º 20
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write($"No Exception to be thrown");
 }
Exemplo n.º 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.Write("<{0}>", actual.GetType().Name);
 }
Exemplo n.º 22
0
 /// <summary>
 /// Write a description of this constraint to a MessageWriter
 /// </summary>
 /// <param name="writer"></param>
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("all items unique");
 }
Exemplo n.º 23
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(MessageWriter writer)
 {
     writer.Write( "An empty directory" );
 }
 /// <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.Write("xml serializable");
 }
Exemplo n.º 25
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(MessageWriter writer)
 {
     writer.Write("property " + name);
 }
Exemplo n.º 26
0
 /// <summary>
 /// Write the constraint description to a MessageWriter
 /// </summary>
 /// <param name="writer"></param>
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("<empty>");
 }
Exemplo n.º 27
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(MessageWriter writer)
 {
     writer.Write("<empty>");
 }
Exemplo n.º 28
0
 /// <summary>
 /// Write the actual value for a failing constraint test to a
 /// MessageWriter. Overridden in ThrowsNothingConstraint to write
 /// information about the exception that was actually caught.
 /// </summary>
 /// <param name="writer">The writer on which the actual value is displayed</param>
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteLine(" ({0})", caughtException.Message);
     writer.Write(caughtException.StackTrace);
 }
Exemplo n.º 29
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(MessageWriter writer)
 {
     writer.Write(description);
 }
Exemplo n.º 30
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     if (Same)
     {
         writer.WriteExpectedValue(expected1);
     }
     else
     {
         writer.WritePredicate("To be between");
         writer.WriteExpectedValue(expected1);
         writer.Write(" and ");
         writer.WriteExpectedValue(expected2);
     }
 }
		public override void WriteDescriptionTo (MessageWriter writer)
		{
			base.WriteDescriptionTo (writer);
			if (haslineinfo)
				writer.Write (string.Format (" line {0}, position {1}", linenumber, lineposition));
		}
Exemplo n.º 32
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(MessageWriter writer)
 {
     writer.Write(description);
 }
Exemplo n.º 33
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("in range ({0},{1})", from, to);
 }
Exemplo n.º 34
0
        /// <summary>
        /// Display the failure information for two collections that did not match.
        /// </summary>
        /// <param name="writer">The MessageWriter on which to display</param>
        /// <param name="expected">The expected collection.</param>
        /// <param name="actual">The actual collection</param>
        /// <param name="depth">The depth of this failure in a set of nested collections</param>
        private void DisplayCollectionDifferences(MessageWriter writer, ICollection expected, ICollection actual, int depth)
        {
            DisplayTypesAndSizes(writer, expected, actual, depth);

            if (failurePoints.Count > depth)
            {
                NUnitEqualityComparer.FailurePoint failurePoint = (NUnitEqualityComparer.FailurePoint)failurePoints[depth];

                DisplayFailurePoint(writer, expected, actual, failurePoint, depth);

                if (failurePoint.ExpectedHasData && failurePoint.ActualHasData)
                    DisplayDifferences(
                        writer,
                        failurePoint.ExpectedValue,
                        failurePoint.ActualValue,
                        ++depth);
                else if (failurePoint.ActualHasData)
                {
                    writer.Write("  Extra:    ");
                    writer.WriteCollectionElements(actual, failurePoint.Position, 3);
                }
                else
                {
                    writer.Write("  Missing:  ");
                    writer.WriteCollectionElements(expected, failurePoint.Position, 3);
                }
            }
        }
 /// <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.Write("null or empty string");
 }
 public override void WriteMessageTo(MessageWriter writer)
 {
     if (_badProperty != null)
         writer.Write("{0} does not implement GetHashCode appropriately. {1} does not appear to be included.", ((Type)actual).Name, _badProperty.Name);
     else
         writer.Write("{0} does not implement GetHashCode appropriately.", ((Type)actual).Name);
 }
 /// <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.Write("<{0}>", actual.GetType().Name);
 }
Exemplo n.º 38
0
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.Write(_failedActualValue);
 }
Exemplo n.º 39
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(MessageWriter writer)
		{
			writer.Write(string.Format("No Exception to be thrown"));
		}
Exemplo n.º 40
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write(_failedExpectedValue);
 }
Exemplo n.º 41
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(MessageWriter writer)
 {
     writer.Write("binary serializable");
 }
Exemplo n.º 42
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(MessageWriter writer)
 {
     writer.Write("property " + name);
 }
Exemplo n.º 43
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(MessageWriter writer)
 {
     writer.Write("An empty directory");
 }
Exemplo n.º 44
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("Link header containing link with ");
     writer.WriteExpectedValue("rel=" + _expectedRel + " and location=<"+_expectedUri+ ">");
 }
Exemplo n.º 45
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(MessageWriter writer)
 {
     writer.Write("null or empty string");
 }
Exemplo n.º 46
0
        /// <summary>
        /// Display the failure information for two collections that did not match.
        /// </summary>
        /// <param name="writer">The MessageWriter on which to display</param>
        /// <param name="expected">The expected collection.</param>
        /// <param name="actual">The actual collection</param>
        /// <param name="depth">The depth of this failure in a set of nested collections</param>
        private void DisplayCollectionDifferences(MessageWriter writer, ICollection expected, ICollection actual, int depth)
        {
            int failurePoint = failurePoints.Count > depth ? (int)failurePoints[depth] : -1;

            DisplayCollectionTypesAndSizes(writer, expected, actual, depth);

            if (failurePoint >= 0)
            {
                DisplayFailurePoint(writer, expected, actual, failurePoint, depth);
                if (failurePoint < expected.Count && failurePoint < actual.Count)
                    DisplayDifferences(
                        writer,
                        GetValueFromCollection(expected, failurePoint),
                        GetValueFromCollection(actual, failurePoint),
                        ++depth);
                else if (expected.Count < actual.Count)
                {
                    writer.Write( "  Extra:    " );
                    writer.WriteCollectionElements( actual, failurePoint, 3 );
                }
                else
                {
                    writer.Write( "  Missing:  " );
                    writer.WriteCollectionElements( expected, failurePoint, 3 );
                }
            }
        }
Exemplo n.º 47
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(MessageWriter writer)
 {
     writer.Write(string.Format("No Exception to be thrown"));
 }
Exemplo n.º 48
0
        /// <summary>
        /// Displays elements from a collection on a line
        /// </summary>
        /// <param name="label">Text to prefix the line with</param>
        /// <param name="list">The list of items to display</param>
        /// <param name="index">The index in the collection of the first element to display</param>
        /// <param name="max">The maximum number of elements to display</param>
        private void DisplayElements(MessageWriter writer, string prefix, ICollection collection, int index, int max)
        {
            writer.Write(prefix + "< ");

            if (collection == null)
                writer.Write("null");
            else if (collection.Count == 0)
                writer.Write("empty");
            else
            {
                for (int i = 0; i < max && index < collection.Count; i++)
                {
                    if (i > 0) writer.Write(", ");

                    writer.WriteValue(GetValueFromCollection(collection, index++));
                }

                if (index < collection.Count)
                    writer.Write("...");
            }

            writer.Write(" >");
        }
Exemplo n.º 49
0
 /// <summary>
 /// Write a description of this constraint to a MessageWriter
 /// </summary>
 /// <param name="writer"></param>
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("all items unique");
 }
Exemplo n.º 50
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(MessageWriter writer)
 {
     baseConstraint.WriteDescriptionTo(writer);
     writer.Write(string.Format(" after {0} millisecond delay", delayInMilliseconds));
 }