コード例 #1
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("[");
     leftConstraint.WriteDescriptionTo(writer);
     writer.WriteConnector("AND");
     rightConstraint.WriteDescriptionTo(writer);
     writer.Write("]");
 }
コード例 #2
0
		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);
			}
		}
コード例 #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);
 }
コード例 #4
0
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.WriteActualValue(" found count (" + MatchCount.ToString() + ")");
     writer.Write("[");
     baseConstraint.WriteDescriptionTo(writer);
     writer.WriteMessageLine("] expected count of {0}", countOccurrence );
 }
コード例 #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);
            }
        }
コード例 #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>");
 }
コード例 #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);
 }
コード例 #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);
     }
 }
コード例 #9
0
        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);
            }
        }
コード例 #10
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);
     }
 }
コード例 #11
0
        /// <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);
            }
        }
コード例 #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());
     }
 }
コード例 #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);
     }
 }
コード例 #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());
     }
 }
コード例 #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());
     }
 }
コード例 #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");
     }
 }
コード例 #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);
        }
コード例 #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());
     }
 }
コード例 #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");
     }
 }
コード例 #20
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write($"No Exception to be thrown");
 }
コード例 #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);
 }
コード例 #22
0
ファイル: CollectionConstraints.cs プロジェクト: nobled/mono
 /// <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");
 }
コード例 #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" );
 }
コード例 #24
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("xml serializable");
 }
コード例 #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);
 }
コード例 #26
0
 /// <summary>
 /// Write the constraint description to a MessageWriter
 /// </summary>
 /// <param name="writer"></param>
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("<empty>");
 }
コード例 #27
0
ファイル: StringConstraints.cs プロジェクト: gezidan/ZYSOCKET
 /// <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>");
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #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);
     }
 }
コード例 #31
0
		public override void WriteDescriptionTo (MessageWriter writer)
		{
			base.WriteDescriptionTo (writer);
			if (haslineinfo)
				writer.Write (string.Format (" line {0}, position {1}", linenumber, lineposition));
		}
コード例 #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);
 }
コード例 #33
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("in range ({0},{1})", from, to);
 }
コード例 #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);
                }
            }
        }
コード例 #35
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");
 }
コード例 #36
0
 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);
 }
コード例 #37
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);
 }
コード例 #38
0
ファイル: Has.cs プロジェクト: korzy1bj/XSerializer
 public override void WriteActualValueTo(MessageWriter writer)
 {
     writer.Write(_failedActualValue);
 }
コード例 #39
0
ファイル: ThrowsConstraint.cs プロジェクト: imgen/Andr.Unit
        /// <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"));
		}
コード例 #40
0
ファイル: Has.cs プロジェクト: korzy1bj/XSerializer
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write(_failedExpectedValue);
 }
コード例 #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");
 }
コード例 #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);
 }
コード例 #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");
 }
コード例 #44
0
 public override void WriteDescriptionTo(MessageWriter writer)
 {
     writer.Write("Link header containing link with ");
     writer.WriteExpectedValue("rel=" + _expectedRel + " and location=<"+_expectedUri+ ">");
 }
コード例 #45
0
ファイル: StringConstraints.cs プロジェクト: gezidan/ZYSOCKET
 /// <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");
 }
コード例 #46
0
ファイル: EqualConstraint.cs プロジェクト: fotisp/conqat
        /// <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 );
                }
            }
        }
コード例 #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"));
 }
コード例 #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(" >");
        }
コード例 #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");
 }
コード例 #50
0
ファイル: DelayedConstraint.cs プロジェクト: ymf1/EmitMapper
 /// <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));
 }