diff options
author | JamesNK <james@newtonking.com> | 2007-09-08 12:59:38 +0400 |
---|---|---|
committer | JamesNK <james@newtonking.com> | 2007-09-08 12:59:38 +0400 |
commit | e65bc2becd3ded759b5d5ca42c7d28a631cfc06d (patch) | |
tree | f9588f5735df2b74843e7baa9a8d2baa855601bc |
43 files changed, 13240 insertions, 0 deletions
diff --git a/Src/Lib/nunit.framework.dll b/Src/Lib/nunit.framework.dll Binary files differnew file mode 100644 index 0000000..de687d9 --- /dev/null +++ b/Src/Lib/nunit.framework.dll diff --git a/Src/Lib/nunit.framework.xml b/Src/Lib/nunit.framework.xml new file mode 100644 index 0000000..8610cfd --- /dev/null +++ b/Src/Lib/nunit.framework.xml @@ -0,0 +1,5521 @@ +<?xml version="1.0"?>
+<doc>
+ <assembly>
+ <name>nunit.framework</name>
+ </assembly>
+ <members>
+ <member name="T:NUnit.Framework.Constraints.SubstringConstraint">
+ <summary>
+ SubstringConstraint can test whether a string contains
+ the expected substring.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.Constraint">
+ <summary>
+ The Constraint class is the base of all built-in or
+ user-defined constraints in NUnit. It provides the operator
+ overloads used to combine constraints.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.Constraint.UNSET">
+ <summary>
+ Static UnsetObject used to detect derived constraints
+ failing to set the actual value.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.Constraint.caseInsensitive">
+ <summary>
+ If true, all string comparisons will ignore case
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.Constraint.compareAsCollection">
+ <summary>
+ If true, arrays will be treated as collections, allowing
+ those of different dimensions to be compared
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.Constraint.tolerance">
+ <summary>
+ If non-zero, equality comparisons within the specified
+ tolerance will succeed.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.Constraint.compareWith">
+ <summary>
+ IComparer object used in comparisons for some constraints.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.Constraint.actual">
+ <summary>
+ The actual value being tested against a constraint
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Constraint.Within(System.Object)">
+ <summary>
+ Flag the constraint to use a tolerance when determining equality.
+ Currently only used for doubles and floats.
+ </summary>
+ <param name="tolerance">Tolerance to be used</param>
+ <returns>Self.</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Constraint.Comparer(System.Collections.IComparer)">
+ <summary>
+ Flag the constraint to use the supplied IComparer object.
+ </summary>
+ <param name="comparer">The IComparer object to use.</param>
+ <returns>Self.</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Constraint.WriteMessageTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the failure message to the MessageWriter provided
+ as an argument. The default implementation simply passes
+ the constraint and the actual value to the writer, which
+ then displays the constraint description and the value.
+
+ Constraints that need to provide additional details,
+ such as where the error occured can override this.
+ </summary>
+ <param name="writer">The MessageWriter on which to display the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Constraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is satisfied by a given value
+ </summary>
+ <param name="actual">The value to be tested</param>
+ <returns>True for success, false for failure</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Constraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the constraint description to a MessageWriter
+ </summary>
+ <param name="writer">The writer on which the description is displayed</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Constraint.WriteActualValueTo(NUnit.Framework.MessageWriter)">
+ <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>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Constraint.op_BitwiseAnd(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ This operator creates a constraint that is satisfied only if both
+ argument constraints are satisfied.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Constraint.op_BitwiseOr(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ This operator creates a constraint that is satisfied if either
+ of the argument constraints is satisfied.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Constraint.op_LogicalNot(NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ This operator creates a constraint that is satisfied if the
+ argument constraint is not satisfied.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.Constraint.IgnoreCase">
+ <summary>
+ Flag the constraint to ignore case and return self.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.Constraint.AsCollection">
+ <summary>
+ Flag the constraint to compare arrays as collections
+ and return self.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.Constraint.UnsetObject">
+ <summary>
+ Class used to detect any derived constraints
+ that fail to set the actual value in their
+ Matches override.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.SubstringConstraint.#ctor(System.String)">
+ <summary>
+ Initializes a new instance of the <see cref="T:SubstringConstraint"/> class.
+ </summary>
+ <param name="expected">The expected.</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.SubstringConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is satisfied by a given value
+ </summary>
+ <param name="actual">The value to be tested</param>
+ <returns>True for success, false for failure</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.SubstringConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the constraint description to a MessageWriter
+ </summary>
+ <param name="writer">The writer on which the description is displayed</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.StartsWithConstraint">
+ <summary>
+ StartsWithConstraint can test whether a string starts
+ with an expected substring.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.StartsWithConstraint.#ctor(System.String)">
+ <summary>
+ Initializes a new instance of the <see cref="T:StartsWithConstraint"/> class.
+ </summary>
+ <param name="expected">The expected string</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.StartsWithConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is matched by the actual value.
+ This is a template method, which calls the IsMatch method
+ of the derived class.
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.StartsWithConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the constraint description to a MessageWriter
+ </summary>
+ <param name="writer">The writer on which the description is displayed</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.EndsWithConstraint">
+ <summary>
+ EndsWithConstraint can test whether a string ends
+ with an expected substring.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EndsWithConstraint.#ctor(System.String)">
+ <summary>
+ Initializes a new instance of the <see cref="T:EndsWithConstraint"/> class.
+ </summary>
+ <param name="expected">The expected string</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EndsWithConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is matched by the actual value.
+ This is a template method, which calls the IsMatch method
+ of the derived class.
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EndsWithConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the constraint description to a MessageWriter
+ </summary>
+ <param name="writer">The writer on which the description is displayed</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.RegexConstraint">
+ <summary>
+ RegexConstraint can test whether a string matches
+ the pattern provided.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.RegexConstraint.#ctor(System.String)">
+ <summary>
+ Initializes a new instance of the <see cref="T:RegexConstraint"/> class.
+ </summary>
+ <param name="pattern">The pattern.</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.RegexConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is satisfied by a given value
+ </summary>
+ <param name="actual">The value to be tested</param>
+ <returns>True for success, false for failure</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.RegexConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the constraint description to a MessageWriter
+ </summary>
+ <param name="writer">The writer on which the description is displayed</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.EmptyConstraint">
+ <summary>
+ EmptyConstraint tests a whether a string or collection is empty,
+ postponing the decision about which test is applied until the
+ type of the actual argument is known.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EmptyConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is satisfied by a given value
+ </summary>
+ <param name="actual">The value to be tested</param>
+ <returns>True for success, false for failure</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EmptyConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the constraint description to a MessageWriter
+ </summary>
+ <param name="writer">The writer on which the description is displayed</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.ConstraintBuilder">
+ <summary>
+ ConstraintBuilder is used to resolve the Not and All properties,
+ which serve as prefix operators for constraints. With the addition
+ of an operand stack, And and Or could be supported, but we have
+ left them out in favor of a simpler, more type-safe implementation.
+ Use the & and | operator overloads to combine constraints.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.op_Implicit(NUnit.Framework.Constraints.ConstraintBuilder)~NUnit.Framework.Constraints.Constraint">
+ <summary>
+ Implicitly convert ConstraintBuilder to an actual Constraint
+ at the point where the syntax demands it.
+ </summary>
+ <param name="builder"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.EqualTo(System.Object)">
+ <summary>
+ Resolves the chain of constraints using an
+ EqualConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.SameAs(System.Object)">
+ <summary>
+ Resolves the chain of constraints using a
+ SameAsConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.LessThan(System.IComparable)">
+ <summary>
+ Resolves the chain of constraints using a
+ LessThanConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.GreaterThan(System.IComparable)">
+ <summary>
+ Resolves the chain of constraints using a
+ GreaterThanConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.LessThanOrEqualTo(System.IComparable)">
+ <summary>
+ Resolves the chain of constraints using a
+ LessThanOrEqualConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.AtMost(System.IComparable)">
+ <summary>
+ Resolves the chain of constraints using a
+ LessThanOrEqualConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.GreaterThanOrEqualTo(System.IComparable)">
+ <summary>
+ Resolves the chain of constraints using a
+ GreaterThanOrEqualConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.AtLeast(System.IComparable)">
+ <summary>
+ Resolves the chain of constraints using a
+ GreaterThanOrEqualConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.TypeOf(System.Type)">
+ <summary>
+ Resolves the chain of constraints using an
+ ExactTypeConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.InstanceOfType(System.Type)">
+ <summary>
+ Resolves the chain of constraints using an
+ InstanceOfTypeConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.AssignableFrom(System.Type)">
+ <summary>
+ Resolves the chain of constraints using an
+ AssignableFromConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.Contains(System.Object)">
+ <summary>
+ Resolves the chain of constraints using a
+ ContainsConstraint as base. This constraint
+ will, in turn, make use of the appropriate
+ second-level constraint, depending on the
+ type of the actual argument.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.Member(System.Object)">
+ <summary>
+ Resolves the chain of constraints using a
+ CollectionContainsConstraint as base.
+ </summary>
+ <param name="expected">The expected object</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.StartsWith(System.String)">
+ <summary>
+ Resolves the chain of constraints using a
+ StartsWithConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.EndsWith(System.String)">
+ <summary>
+ Resolves the chain of constraints using a
+ StringEndingConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.Matches(System.String)">
+ <summary>
+ Resolves the chain of constraints using a
+ StringMatchingConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.EquivalentTo(System.Collections.ICollection)">
+ <summary>
+ Resolves the chain of constraints using a
+ CollectionEquivalentConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.CollectionContaining(System.Object)">
+ <summary>
+ Resolves the chain of constraints using a
+ CollectionContainingConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.SubsetOf(System.Collections.ICollection)">
+ <summary>
+ Resolves the chain of constraints using a
+ CollectionSubsetConstraint as base.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.Property(System.String,System.Object)">
+ <summary>
+ Resolves the chain of constraints using a
+ PropertyConstraint as base
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.Length(System.Int32)">
+ <summary>
+ Resolves the chain of constraints using a
+ PropertyCOnstraint on Length as base
+ </summary>
+ <param name="length"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.Count(System.Int32)">
+ <summary>
+ Resolves the chain of constraints using a
+ PropertyCOnstraint on Length as base
+ </summary>
+ <param name="count"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.Property(System.String)">
+ <summary>
+ Modifies the ConstraintBuilder by pushing a Prop operator on the
+ ops stack and the name of the property on the opnds stack.
+ </summary>
+ <param name="name"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ConstraintBuilder.Resolve(NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Resolve a constraint that has been recognized by applying
+ any pending operators and returning the resulting Constraint.
+ </summary>
+ <returns>A constraint that incorporates all pending operators</returns>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.ConstraintBuilder.Null">
+ <summary>
+ Resolves the chain of constraints using
+ EqualConstraint(null) as base.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.ConstraintBuilder.True">
+ <summary>
+ Resolves the chain of constraints using
+ EqualConstraint(true) as base.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.ConstraintBuilder.False">
+ <summary>
+ Resolves the chain of constraints using
+ EqualConstraint(false) as base.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.ConstraintBuilder.NaN">
+ <summary>
+ Resolves the chain of constraints using
+ Is.NaN as base.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.ConstraintBuilder.Empty">
+ <summary>
+ Resolves the chain of constraints using
+ Is.Empty as base.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.ConstraintBuilder.Unique">
+ <summary>
+ Resolves the chain of constraints using
+ Is.Unique as base.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.ConstraintBuilder.Not">
+ <summary>
+ Modifies the ConstraintBuilder by pushing a Not operator on the stack.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.ConstraintBuilder.No">
+ <summary>
+ Modifies the ConstraintBuilder by pushing a Not operator on the stack.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.ConstraintBuilder.All">
+ <summary>
+ Modifies the ConstraintBuilder by pushing an All operator on the stack.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.ConstraintBuilder.Some">
+ <summary>
+ Modifies the ConstraintBuilder by pushing a Some operator on the stack.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.ConstraintBuilder.None">
+ <summary>
+ Modifies the constraint builder by pushing All and Not operators on the stack
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.CollectionConstraint">
+ <summary>
+ CollectionConstraint is the abstract base class for
+ constraints that operate on collections.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is satisfied by a given value
+ </summary>
+ <param name="actual">The value to be tested</param>
+ <returns>True for success, false for failure</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionConstraint.doMatch(System.Collections.ICollection)">
+ <summary>
+ Protected method to be implemented by derived classes
+ </summary>
+ <param name="collecton"></param>
+ <returns></returns>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.CollectionConstraint.CollectionTally">
+ <summary>
+ CollectionTally counts (tallies) the number of
+ occurences of each object in one or more enuerations.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionConstraint.CollectionTally.#ctor(System.Collections.IEnumerable)">
+ <summary>
+ Construct a CollectionTally object from a collection
+ </summary>
+ <param name="collection"></param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionConstraint.CollectionTally.CanRemove(System.Collections.IEnumerable)">
+ <summary>
+ Remove the counts for a collection from the tally,
+ so long as their are sufficient items to remove.
+ The tallies are not permitted to become negative.
+ </summary>
+ <param name="c">The collection to remove</param>
+ <returns>True if there were enough items to remove, otherwise false</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionConstraint.CollectionTally.AllCountsEqualTo(System.Int32)">
+ <summary>
+ Test whether all the counts are equal to a given value
+ </summary>
+ <param name="count">The value to be looked for</param>
+ <returns>True if all counts are equal to the value, otherwise false</returns>
+ </member>
+ <member name="P:NUnit.Framework.Constraints.CollectionConstraint.CollectionTally.Item(System.Object)">
+ <summary>
+ Get the count of the number of times an object is present in the tally
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.UniqueItemsConstraint">
+ <summary>
+ UniqueItemsConstraint tests whether all the items in a
+ collection are unique.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.UniqueItemsConstraint.doMatch(System.Collections.ICollection)">
+ <summary>
+ Apply the item constraint to each item in the collection,
+ failing if any item fails.
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.UniqueItemsConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a description of this constraint to a MessageWriter
+ </summary>
+ <param name="writer"></param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.CollectionContainsConstraint">
+ <summary>
+ CollectionContainsConstraint is used to test whether a collection
+ contains an expected object as a member.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionContainsConstraint.#ctor(System.Object)">
+ <summary>
+ Construct a CollectionContainsConstraint
+ </summary>
+ <param name="expected"></param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionContainsConstraint.doMatch(System.Collections.ICollection)">
+ <summary>
+ Test whether the expected item is contained in the collection
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionContainsConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a descripton of the constraint to a MessageWriter
+ </summary>
+ <param name="writer"></param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.CollectionEquivalentConstraint">
+ <summary>
+ CollectionEquivalentCOnstraint is used to determine whether two
+ collections are equivalent.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionEquivalentConstraint.#ctor(System.Collections.IEnumerable)">
+ <summary>
+ Construct a CollectionEquivalentConstraint
+ </summary>
+ <param name="expected"></param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionEquivalentConstraint.doMatch(System.Collections.ICollection)">
+ <summary>
+ Test whether two collections are equivalent
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionEquivalentConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a description of this constraint to a MessageWriter
+ </summary>
+ <param name="writer"></param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.CollectionSubsetConstraint">
+ <summary>
+ CollectionSubsetConstraint is used to determine whether
+ one collection is a subset of another
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionSubsetConstraint.#ctor(System.Collections.IEnumerable)">
+ <summary>
+ Construct a CollectionSubsetConstraint
+ </summary>
+ <param name="expected">The collection that the actual value is expected to be a subset of</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionSubsetConstraint.doMatch(System.Collections.ICollection)">
+ <summary>
+ Test whether the actual collection is a subset of
+ the expected collection provided.
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.CollectionSubsetConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a description of this constraint to a MessageWriter
+ </summary>
+ <param name="writer"></param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.EqualConstraint">
+ <summary>
+ EqualConstraint is able to compare an actual value with the
+ expected value provided in its constructor.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EqualConstraint.#ctor(System.Object)">
+ <summary>
+ Initializes a new instance of the <see cref="T:EqualConstraint"/> class.
+ </summary>
+ <param name="expected">The expected value.</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EqualConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is satisfied by a given value
+ </summary>
+ <param name="actual">The value to be tested</param>
+ <returns>True for success, false for failure</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EqualConstraint.WriteMessageTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a failure message. Overridden to provide custom
+ failure messages for EqualConstraint.
+ </summary>
+ <param name="writer">The MessageWriter to write to</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EqualConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write description of this constraint
+ </summary>
+ <param name="writer">The MessageWriter to write to</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EqualConstraint.ArraysEqual(System.Array,System.Array)">
+ <summary>
+ Helper method to compare two arrays
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EqualConstraint.DisplayCollectionDifferences(NUnit.Framework.MessageWriter,System.Collections.ICollection,System.Collections.ICollection,System.Int32)">
+ <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>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EqualConstraint.DisplayCollectionTypesAndSizes(NUnit.Framework.MessageWriter,System.Collections.ICollection,System.Collections.ICollection,System.Int32)">
+ <summary>
+ Displays a single line showing the types and sizes of the expected
+ and actual collections or arrays. If both are identical, the value is
+ only shown once.
+ </summary>
+ <param name="writer">The MessageWriter on which to display</param>
+ <param name="expected">The expected collection or array</param>
+ <param name="actual">The actual collection or array</param>
+ <param name="indent">The indentation level for the message line</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.EqualConstraint.DisplayFailurePoint(NUnit.Framework.MessageWriter,System.Collections.ICollection,System.Collections.ICollection,System.Int32,System.Int32)">
+ <summary>
+ Displays a single line showing the point in the expected and actual
+ arrays at which the comparison failed. If the arrays have different
+ structures or dimensions, both values are shown.
+ </summary>
+ <param name="writer">The MessageWriter on which to display</param>
+ <param name="expected">The expected array</param>
+ <param name="actual">The actual array</param>
+ <param name="failurePoint">Index of the failure point in the underlying collections</param>
+ <param name="indent">The indentation level for the message line</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.PrefixConstraint">
+ <summary>
+ Abstract base class used for prefixes
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.PrefixConstraint.baseConstraint">
+ <summary>
+ The base constraint
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.PrefixConstraint.#ctor(NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Construct given a base constraint
+ </summary>
+ <param name="baseConstraint"></param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.PrefixConstraint.PassModifiersToBase">
+ <summary>
+ Set all modifiers applied to the prefix into
+ the base constraint before matching
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.NotConstraint">
+ <summary>
+ NotConstraint negates the effect of some other constraint
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.NotConstraint.#ctor(NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Initializes a new instance of the <see cref="T:NotConstraint"/> class.
+ </summary>
+ <param name="baseConstraint">The base constraint to be negated.</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.NotConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is satisfied by a given value
+ </summary>
+ <param name="actual">The value to be tested</param>
+ <returns>True for if the base constraint fails, false if it succeeds</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.NotConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the constraint description to a MessageWriter
+ </summary>
+ <param name="writer">The writer on which the description is displayed</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.NotConstraint.WriteActualValueTo(NUnit.Framework.MessageWriter)">
+ <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>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.AllItemsConstraint">
+ <summary>
+ AllItemsConstraint applies another constraint to each
+ item in a collection, succeeding if they all succeed.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.AllItemsConstraint.#ctor(NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Construct an AllItemsConstraint on top of an existing constraint
+ </summary>
+ <param name="itemConstraint"></param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.AllItemsConstraint.Matches(System.Object)">
+ <summary>
+ Apply the item constraint to each item in the collection,
+ failing if any item fails.
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.AllItemsConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a description of this constraint to a MessageWriter
+ </summary>
+ <param name="writer"></param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.SomeItemsConstraint">
+ <summary>
+ SomeItemsConstraint applies another constraint to each
+ item in a collection, succeeding if any of them succeeds.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.SomeItemsConstraint.#ctor(NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Construct a SomeItemsConstraint on top of an existing constraint
+ </summary>
+ <param name="itemConstraint"></param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.SomeItemsConstraint.Matches(System.Object)">
+ <summary>
+ Apply the item constraint to each item in the collection,
+ failing if any item fails.
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.SomeItemsConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a description of this constraint to a MessageWriter
+ </summary>
+ <param name="writer"></param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.NoItemConstraint">
+ <summary>
+ SomeItemsConstraint applies another constraint to each
+ item in a collection, succeeding if any of them succeeds.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.NoItemConstraint.#ctor(NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Construct a SomeItemsConstraint on top of an existing constraint
+ </summary>
+ <param name="itemConstraint"></param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.NoItemConstraint.Matches(System.Object)">
+ <summary>
+ Apply the item constraint to each item in the collection,
+ failing if any item fails.
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.NoItemConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a description of this constraint to a MessageWriter
+ </summary>
+ <param name="writer"></param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.SameAsConstraint">
+ <summary>
+ SameAsConstraint tests whether an object is identical to
+ the object passed to its constructor
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.SameAsConstraint.#ctor(System.Object)">
+ <summary>
+ Initializes a new instance of the <see cref="T:SameAsConstraint"/> class.
+ </summary>
+ <param name="expected">The expected object.</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.SameAsConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is satisfied by a given value
+ </summary>
+ <param name="actual">The value to be tested</param>
+ <returns>True for success, false for failure</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.SameAsConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the constraint description to a MessageWriter
+ </summary>
+ <param name="writer">The writer on which the description is displayed</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.TypeConstraint">
+ <summary>
+ TypeConstraint is the abstract base for constraints
+ that take a Type as their expected value.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.TypeConstraint.expectedType">
+ <summary>
+ The expected Type used by the constraint
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.TypeConstraint.#ctor(System.Type)">
+ <summary>
+ Construct a TypeConstraint for a given Type
+ </summary>
+ <param name="type"></param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.TypeConstraint.WriteActualValueTo(NUnit.Framework.MessageWriter)">
+ <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>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.ExactTypeConstraint">
+ <summary>
+ ExactTypeConstraint is used to test that an object
+ is of the exact type provided in the constructor
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ExactTypeConstraint.#ctor(System.Type)">
+ <summary>
+ Construct an ExactTypeConstraint for a given Type
+ </summary>
+ <param name="type"></param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ExactTypeConstraint.Matches(System.Object)">
+ <summary>
+ Test that an object is of the exact type specified
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ExactTypeConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the description of this constraint to a MessageWriter
+ </summary>
+ <param name="writer"></param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.InstanceOfTypeConstraint">
+ <summary>
+ InstanceOfTypeConstraint is used to test that an object
+ is of the same type provided or derived from it.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.InstanceOfTypeConstraint.#ctor(System.Type)">
+ <summary>
+ Construct an InstanceOfTypeConstraint for the type provided
+ </summary>
+ <param name="type"></param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.InstanceOfTypeConstraint.Matches(System.Object)">
+ <summary>
+ Test whether an object is of the specified type or a derived type
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.InstanceOfTypeConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a description of this constraint to a MessageWriter
+ </summary>
+ <param name="writer"></param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.AssignableFromConstraint">
+ <summary>
+ AssignableFromConstraint is used to test that an object
+ can be assigned from a given Type.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.AssignableFromConstraint.#ctor(System.Type)">
+ <summary>
+ Construct an AssignableFromConstraint for the type provided
+ </summary>
+ <param name="type"></param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.AssignableFromConstraint.Matches(System.Object)">
+ <summary>
+ Test whether an object can be assigned from the specified type
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.AssignableFromConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a description of this constraint to a MessageWriter
+ </summary>
+ <param name="writer"></param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.ComparisonConstraint">
+ <summary>
+ Abstract base class for constraints that compare values to
+ determine if one is greater than, equal to or less than
+ the other.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.ComparisonConstraint.expected">
+ <summary>
+ The value against which a comparison is to be made
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.ComparisonConstraint.ltOK">
+ <summary>
+ If true, less than returns success
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.ComparisonConstraint.eqOK">
+ <summary>
+ if true, equal returns success
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.ComparisonConstraint.gtOK">
+ <summary>
+ if true, greater than returns success
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.ComparisonConstraint.predicate">
+ <summary>
+ The predicate used as a part of the description
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ComparisonConstraint.#ctor(System.IComparable,System.Boolean,System.Boolean,System.Boolean,System.String)">
+ <summary>
+ Initializes a new instance of the <see cref="T:ComparisonConstraint"/> class.
+ </summary>
+ <param name="value">The value against which to make a comparison.</param>
+ <param name="ltOK">if set to <c>true</c> less succeeds.</param>
+ <param name="eqOK">if set to <c>true</c> equal succeeds.</param>
+ <param name="gtOK">if set to <c>true</c> greater succeeds.</param>
+ <param name="predicate">String used in describing the constraint.</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ComparisonConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is satisfied by a given value
+ </summary>
+ <param name="actual">The value to be tested</param>
+ <returns>True for success, false for failure</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ComparisonConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the constraint description to a MessageWriter
+ </summary>
+ <param name="writer">The writer on which the description is displayed</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.GreaterThanConstraint">
+ <summary>
+ Tests whether a value is greater than the value supplied to its constructor
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.GreaterThanConstraint.#ctor(System.IComparable)">
+ <summary>
+ Initializes a new instance of the <see cref="T:GreaterThanConstraint"/> class.
+ </summary>
+ <param name="expected">The expected value.</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.GreaterThanOrEqualConstraint">
+ <summary>
+ Tests whether a value is greater than or equal to the value supplied to its constructor
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.GreaterThanOrEqualConstraint.#ctor(System.IComparable)">
+ <summary>
+ Initializes a new instance of the <see cref="T:GreaterThanOrEqualConstraint"/> class.
+ </summary>
+ <param name="expected">The expected value.</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.LessThanConstraint">
+ <summary>
+ Tests whether a value is less than the value supplied to its constructor
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.LessThanConstraint.#ctor(System.IComparable)">
+ <summary>
+ Initializes a new instance of the <see cref="T:LessThanConstraint"/> class.
+ </summary>
+ <param name="expected">The expected value.</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.LessThanOrEqualConstraint">
+ <summary>
+ Tests whether a value is less than or equal to the value supplied to its constructor
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.LessThanOrEqualConstraint.#ctor(System.IComparable)">
+ <summary>
+ Initializes a new instance of the <see cref="T:LessThanOrEqualConstraint"/> class.
+ </summary>
+ <param name="expected">The expected value.</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.ContainsConstraint">
+ <summary>
+ ContainsConstraint tests a whether a string contains a substring
+ or a collection contains an object. It postpones the decision of
+ which test to use until the type of the actual argument is known.
+ This allows testing whether a string is contained in a collection
+ or as a substring of another string using the same syntax.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ContainsConstraint.#ctor(System.Object)">
+ <summary>
+ Initializes a new instance of the <see cref="T:ContainsConstraint"/> class.
+ </summary>
+ <param name="expected">The expected.</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ContainsConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is satisfied by a given value
+ </summary>
+ <param name="actual">The value to be tested</param>
+ <returns>True for success, false for failure</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.ContainsConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the constraint description to a MessageWriter
+ </summary>
+ <param name="writer">The writer on which the description is displayed</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.PropertyConstraint">
+ <summary>
+ Summary description for PropertyConstraint.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.PropertyConstraint.#ctor(System.String,NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Initializes a new instance of the <see cref="T:PropertyConstraint"/> class.
+ </summary>
+ <param name="name">The name.</param>
+ <param name="baseConstraint">The constraint to apply to the property.</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.PropertyConstraint.Matches(System.Object)">
+ <summary>
+ Test whether the constraint is satisfied by a given value
+ </summary>
+ <param name="actual">The value to be tested</param>
+ <returns>True for success, false for failure</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.PropertyConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write the constraint description to a MessageWriter
+ </summary>
+ <param name="writer">The writer on which the description is displayed</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.PropertyConstraint.WriteActualValueTo(NUnit.Framework.MessageWriter)">
+ <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>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.BinaryOperation">
+ <summary>
+ BinaryOperation is the abstract base of all constraints
+ that combine two other constraints in some fashion.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.BinaryOperation.left">
+ <summary>
+ The first constraint being combined
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.Constraints.BinaryOperation.right">
+ <summary>
+ The second constraint being combined
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.BinaryOperation.#ctor(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Construct a BinaryOperation from two other constraints
+ </summary>
+ <param name="left">The first constraint</param>
+ <param name="right">The second constraint</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.AndConstraint">
+ <summary>
+ AndConstraint succeeds only if both members succeed.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.AndConstraint.#ctor(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Create an AndConstraint from two other constraints
+ </summary>
+ <param name="left">The first constraint</param>
+ <param name="right">The second constraint</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.AndConstraint.Matches(System.Object)">
+ <summary>
+ Apply both member constraints to an actual value, succeeding
+ succeeding only if both of them succeed.
+ </summary>
+ <param name="actual">The actual value</param>
+ <returns>True if the constraints both succeeded</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.AndConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a description for this contraint to a MessageWriter
+ </summary>
+ <param name="writer">The MessageWriter to receive the description</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.OrConstraint">
+ <summary>
+ OrConstraint succeeds if either member succeeds
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.OrConstraint.#ctor(NUnit.Framework.Constraints.Constraint,NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Create an OrConstraint from two other constraints
+ </summary>
+ <param name="left">The first constraint</param>
+ <param name="right">The second constraint</param>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.OrConstraint.Matches(System.Object)">
+ <summary>
+ Apply the member constraints to an actual value, succeeding
+ succeeding as soon as one of them succeeds.
+ </summary>
+ <param name="actual">The actual value</param>
+ <returns>True if either constraint succeeded</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.OrConstraint.WriteDescriptionTo(NUnit.Framework.MessageWriter)">
+ <summary>
+ Write a description for this contraint to a MessageWriter
+ </summary>
+ <param name="writer">The MessageWriter to receive the description</param>
+ </member>
+ <member name="T:NUnit.Framework.Constraints.Numerics">
+ <summary>
+ The Numerics class contains common operations on numeric values.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Numerics.IsNumericType(System.Object)">
+ <summary>
+ Checks the type of the object, returning true if
+ the object is a numeric type.
+ </summary>
+ <param name="obj">The object to check</param>
+ <returns>true if the object is a numeric type</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Numerics.IsFloatingPointNumeric(System.Object)">
+ <summary>
+ Checks the type of the object, returning true if
+ the object is a floating point numeric type.
+ </summary>
+ <param name="obj">The object to check</param>
+ <returns>true if the object is a floating point numeric type</returns>
+ </member>
+ <member name="M:NUnit.Framework.Constraints.Numerics.IsFixedPointNumeric(System.Object)">
+ <summary>
+ Checks the type of the object, returning true if
+ the object is a fixed point numeric type.
+ </summary>
+ <param name="obj">The object to check</param>
+ <returns>true if the object is a fixed point numeric type</returns>
+ </member>
+ <member name="T:NUnit.Framework.SyntaxHelpers.Is">
+ <summary>
+ The Is class is a helper class with properties and methods
+ that supply a number of constraints used in Asserts.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.SyntaxHelpers.Is.Null">
+ <summary>
+ Is.Null returns a static constraint that tests for null
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.SyntaxHelpers.Is.True">
+ <summary>
+ Is.True returns a static constraint that tests whether a value is true
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.SyntaxHelpers.Is.False">
+ <summary>
+ Is.False returns a static constraint that tests whether a value is false
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.SyntaxHelpers.Is.NaN">
+ <summary>
+ Is.NaN returns a static constraint that tests whether a value is an NaN
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.SyntaxHelpers.Is.Empty">
+ <summary>
+ Is.Empty returns a static constraint that tests whether a string or collection is empty
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.SyntaxHelpers.Is.Unique">
+ <summary>
+ Is.Unique returns a static constraint that tests whether a collection contains all unque items.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.EqualTo(System.Object)">
+ <summary>
+ Is.EqualTo returns a constraint that tests whether the
+ actual value equals the supplied argument
+ </summary>
+ <param name="expected"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.SameAs(System.Object)">
+ <summary>
+ Is.SameAs returns a constraint that tests whether the
+ actual value is the same object as the supplied argument.
+ </summary>
+ <param name="expected"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.GreaterThan(System.IComparable)">
+ <summary>
+ Is.GreaterThan returns a constraint that tests whether the
+ actual value is greater than the suppled argument
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.GreaterThanOrEqualTo(System.IComparable)">
+ <summary>
+ Is.GreaterThanOrEqualTo returns a constraint that tests whether the
+ actual value is greater than or equal to the suppled argument
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.AtLeast(System.IComparable)">
+ <summary>
+ Is.AtLeast is a synonym for Is.GreaterThanOrEqualTo
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.LessThan(System.IComparable)">
+ <summary>
+ Is.LessThan returns a constraint that tests whether the
+ actual value is less than the suppled argument
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.LessThanOrEqualTo(System.IComparable)">
+ <summary>
+ Is.LessThanOrEqualTo returns a constraint that tests whether the
+ actual value is less than or equal to the suppled argument
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.AtMost(System.IComparable)">
+ <summary>
+ Is.AtMost is a synonym for Is.LessThanOrEqualTo
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.TypeOf(System.Type)">
+ <summary>
+ Is.TypeOf returns a constraint that tests whether the actual
+ value is of the exact type supplied as an argument.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.InstanceOfType(System.Type)">
+ <summary>
+ Is.InstanceOfType returns a constraint that tests whether
+ the actual value is of the type supplied as an argument
+ or a derived type.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.AssignableFrom(System.Type)">
+ <summary>
+ Is.AssignableFrom returns a constraint that tests whether
+ the actual value is assignable from the type supplied as
+ an argument.
+ </summary>
+ <param name="expectedType"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.EquivalentTo(System.Collections.ICollection)">
+ <summary>
+ Is.EquivalentTo returns a constraint that tests whether
+ the actual value is a collection containing the same
+ elements as the collection supplied as an arument
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Is.SubsetOf(System.Collections.ICollection)">
+ <summary>
+ Is.SubsetOf returns a constraint that tests whether
+ the actual value is a subset of the collection
+ supplied as an arument
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.SyntaxHelpers.Is.Not">
+ <summary>
+ Is.Not returns a ConstraintBuilder that negates
+ the constraint that follows it.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.SyntaxHelpers.Is.All">
+ <summary>
+ Is.All returns a ConstraintBuilder, which will apply
+ the following constraint to all members of a collection,
+ succeeding if all of them succeed. This property is
+ a synonym for Has.AllItems.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.SyntaxHelpers.Iz">
+ <summary>
+ The Iz class is a synonym for Is intended for use in VB,
+ which regards Is as a keyword.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.SyntaxHelpers.Text">
+ <summary>
+ The Text class is a helper class with properties and methods
+ that supply a number of constraints used with strings.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Text.Contains(System.String)">
+ <summary>
+ Contains returns a constraint that succeeds if the actual
+ value contains the substring supplied as an argument.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Text.DoesNotContain(System.String)">
+ <summary>
+ DoesNotContain returns a constraint that fails if the actual
+ value contains the substring supplied as an argument.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Text.StartsWith(System.String)">
+ <summary>
+ StartsWith returns a constraint that succeeds if the actual
+ value starts with the substring supplied as an argument.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Text.DoesNotStartWith(System.String)">
+ <summary>
+ DoesNotStartWith returns a constraint that fails if the actual
+ value starts with the substring supplied as an argument.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Text.EndsWith(System.String)">
+ <summary>
+ EndsWith returns a constraint that succeeds if the actual
+ value ends with the substring supplied as an argument.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Text.DoesNotEndWith(System.String)">
+ <summary>
+ DoesNotEndWith returns a constraint that fails if the actual
+ value ends with the substring supplied as an argument.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Text.Matches(System.String)">
+ <summary>
+ Matches returns a constraint that succeeds if the actual
+ value matches the pattern supplied as an argument.
+ </summary>
+ <param name="pattern"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Text.DoesNotMatch(System.String)">
+ <summary>
+ DoesNotMatch returns a constraint that failss if the actual
+ value matches the pattern supplied as an argument.
+ </summary>
+ <param name="pattern"></param>
+ <returns></returns>
+ </member>
+ <member name="P:NUnit.Framework.SyntaxHelpers.Text.All">
+ <summary>
+ Text.All returns a ConstraintBuilder, which will apply
+ the following constraint to all members of a collection,
+ succeeding if all of them succeed.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.SyntaxHelpers.List">
+ <summary>
+ The List class is a helper class with properties and methods
+ that supply a number of constraints used with lists and collections.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.List.Map(System.Collections.ICollection)">
+ <summary>
+ List.Map returns a ListMapper, which can be used to map
+ the original collection to another collection.
+ </summary>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="T:NUnit.Framework.SyntaxHelpers.ListMapper">
+ <summary>
+ ListMapper is used to transform a collection used as an actual argument
+ producing another collection to be used in the assertion.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.ListMapper.#ctor(System.Collections.ICollection)">
+ <summary>
+ Construct a ListMapper based on a collection
+ </summary>
+ <param name="original">The collection to be transformed</param>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.ListMapper.Property(System.String)">
+ <summary>
+ Produces a collection containing all the values of a property
+ </summary>
+ <param name="name">The collection of property values</param>
+ <returns></returns>
+ </member>
+ <member name="T:NUnit.Framework.SyntaxHelpers.Has">
+ <summary>
+ Summary description for HasNoPrefixB.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Has.Property(System.String)">
+ <summary>
+ Returns a new ConstraintBuilder, which will apply the
+ following constraint to a named property of the object
+ being tested.
+ </summary>
+ <param name="name">The name of the property</param>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Has.Property(System.String,System.Object)">
+ <summary>
+ Returns a new PropertyConstraint checking for the
+ existence of a particular property value.
+ </summary>
+ <param name="name">The name of the property to look for</param>
+ <param name="expected">The expected value of the property</param>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Has.Length(System.Int32)">
+ <summary>
+ Returns a new PropertyConstraint for the Length property
+ </summary>
+ <param name="length"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Has.Count(System.Int32)">
+ <summary>
+ Returns a new PropertyConstraint or the Count property
+ </summary>
+ <param name="count"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Has.Member(System.Object)">
+ <summary>
+ Returns a new CollectionContainsConstraint checking for the
+ presence of a particular object in the collection.
+ </summary>
+ <param name="expected">The expected object</param>
+ </member>
+ <member name="P:NUnit.Framework.SyntaxHelpers.Has.No">
+ <summary>
+ Has.No returns a ConstraintBuilder that negates
+ the constraint that follows it.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.SyntaxHelpers.Has.All">
+ <summary>
+ Has.AllItems returns a ConstraintBuilder, which will apply
+ the following constraint to all members of a collection,
+ succeeding if all of them succeed.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.SyntaxHelpers.Has.Some">
+ <summary>
+ Has.Some returns a ConstraintBuilder, which will apply
+ the following constraint to all members of a collection,
+ succeeding if any of them succeed. It is a synonym
+ for Has.Item.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.SyntaxHelpers.Has.None">
+ <summary>
+ Has.None returns a ConstraintBuilder, which will apply
+ the following constraint to all members of a collection,
+ succeeding only if none of them succeed.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.SyntaxHelpers.Has.HasNoPrefixBuilder">
+ <summary>
+ Nested class that allows us to restrict the number
+ of key words that may appear after Has.No.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Has.HasNoPrefixBuilder.Property(System.String)">
+ <summary>
+ Return a ConstraintBuilder conditioned to apply
+ the following constraint to a property.
+ </summary>
+ <param name="name">The property name</param>
+ <returns>A ConstraintBuilder</returns>
+ </member>
+ <member name="M:NUnit.Framework.SyntaxHelpers.Has.HasNoPrefixBuilder.Member(System.Object)">
+ <summary>
+ Return a Constraint that succeeds if the expected object is
+ not contained in a collection.
+ </summary>
+ <param name="expected">The expected object</param>
+ <returns>A Constraint</returns>
+ </member>
+ <member name="T:NUnit.Framework.Assert">
+ <summary>
+ The Assert class contains a collection of static methods that
+ implement the most common assertions used in NUnit.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Assert.#ctor">
+ <summary>
+ We don't actually want any instances of this object, but some people
+ like to inherit from it to add other static methods. Hence, the
+ protected constructor disallows any instances of this object.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Equals(System.Object,System.Object)">
+ <summary>
+ The Equals method throws an AssertionException. This is done
+ to make sure there is no mistake by calling this function.
+ </summary>
+ <param name="a"></param>
+ <param name="b"></param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.ReferenceEquals(System.Object,System.Object)">
+ <summary>
+ override the default ReferenceEquals to throw an AssertionException. This
+ implementation makes sure there is no mistake in calling this function
+ as part of Assert.
+ </summary>
+ <param name="a"></param>
+ <param name="b"></param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsTrue(System.Boolean,System.String,System.Object[])">
+ <summary>
+ Asserts that a condition is true. If the condition is false the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ <param name="message">The message to display if the condition is false</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsTrue(System.Boolean,System.String)">
+ <summary>
+ Asserts that a condition is true. If the condition is false the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ <param name="message">The message to display if the condition is false</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsTrue(System.Boolean)">
+ <summary>
+ Asserts that a condition is true. If the condition is false the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsFalse(System.Boolean,System.String,System.Object[])">
+ <summary>
+ Asserts that a condition is false. If the condition is true the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ <param name="message">The message to display if the condition is true</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsFalse(System.Boolean,System.String)">
+ <summary>
+ Asserts that a condition is false. If the condition is true the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ <param name="message">The message to display if the condition is true</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsFalse(System.Boolean)">
+ <summary>
+ Asserts that a condition is false. If the condition is true the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotNull(System.Object,System.String,System.Object[])">
+ <summary>
+ Verifies that the object that is passed in is not equal to <code>null</code>
+ If the object is <code>null</code> then an <see cref="T:NUnit.Framework.AssertionException"/>
+ is thrown.
+ </summary>
+ <param name="anObject">The object that is to be tested</param>
+ <param name="message">The message to be displayed when the object is null</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotNull(System.Object,System.String)">
+ <summary>
+ Verifies that the object that is passed in is not equal to <code>null</code>
+ If the object is <code>null</code> then an <see cref="T:NUnit.Framework.AssertionException"/>
+ is thrown.
+ </summary>
+ <param name="anObject">The object that is to be tested</param>
+ <param name="message">The message to be displayed when the object is null</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotNull(System.Object)">
+ <summary>
+ Verifies that the object that is passed in is not equal to <code>null</code>
+ If the object is <code>null</code> then an <see cref="T:NUnit.Framework.AssertionException"/>
+ is thrown.
+ </summary>
+ <param name="anObject">The object that is to be tested</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNull(System.Object,System.String,System.Object[])">
+ <summary>
+ Verifies that the object that is passed in is equal to <code>null</code>
+ If the object is not <code>null</code> then an <see cref="T:NUnit.Framework.AssertionException"/>
+ is thrown.
+ </summary>
+ <param name="anObject">The object that is to be tested</param>
+ <param name="message">The message to be displayed when the object is not null</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNull(System.Object,System.String)">
+ <summary>
+ Verifies that the object that is passed in is equal to <code>null</code>
+ If the object is not <code>null</code> then an <see cref="T:NUnit.Framework.AssertionException"/>
+ is thrown.
+ </summary>
+ <param name="anObject">The object that is to be tested</param>
+ <param name="message">The message to be displayed when the object is not null</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNull(System.Object)">
+ <summary>
+ Verifies that the object that is passed in is equal to <code>null</code>
+ If the object is not null <code>null</code> then an <see cref="T:NUnit.Framework.AssertionException"/>
+ is thrown.
+ </summary>
+ <param name="anObject">The object that is to be tested</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNaN(System.Double,System.String,System.Object[])">
+ <summary>
+ Verifies that the double is passed is an <code>NaN</code> value.
+ If the object is not <code>NaN</code> then an <see cref="T:NUnit.Framework.AssertionException"/>
+ is thrown.
+ </summary>
+ <param name="aDouble">The value that is to be tested</param>
+ <param name="message">The message to be displayed when the object is not null</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNaN(System.Double,System.String)">
+ <summary>
+ Verifies that the double is passed is an <code>NaN</code> value.
+ If the object is not <code>NaN</code> then an <see cref="T:NUnit.Framework.AssertionException"/>
+ is thrown.
+ </summary>
+ <param name="aDouble">The object that is to be tested</param>
+ <param name="message">The message to be displayed when the object is not null</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNaN(System.Double)">
+ <summary>
+ Verifies that the double is passed is an <code>NaN</code> value.
+ If the object is not <code>NaN</code> then an <see cref="T:NUnit.Framework.AssertionException"/>
+ is thrown.
+ </summary>
+ <param name="aDouble">The object that is to be tested</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsEmpty(System.String,System.String,System.Object[])">
+ <summary>
+ Assert that a string is empty - that is equal to string.Empty
+ </summary>
+ <param name="aString">The string to be tested</param>
+ <param name="message">The message to be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsEmpty(System.String,System.String)">
+ <summary>
+ Assert that a string is empty - that is equal to string.Emtpy
+ </summary>
+ <param name="aString">The string to be tested</param>
+ <param name="message">The message to be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsEmpty(System.String)">
+ <summary>
+ Assert that a string is empty - that is equal to string.Emtpy
+ </summary>
+ <param name="aString">The string to be tested</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsEmpty(System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Assert that an array, list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ <param name="message">The message to be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsEmpty(System.Collections.ICollection,System.String)">
+ <summary>
+ Assert that an array, list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ <param name="message">The message to be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsEmpty(System.Collections.ICollection)">
+ <summary>
+ Assert that an array,list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotEmpty(System.String,System.String,System.Object[])">
+ <summary>
+ Assert that a string is not empty - that is not equal to string.Empty
+ </summary>
+ <param name="aString">The string to be tested</param>
+ <param name="message">The message to be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotEmpty(System.String,System.String)">
+ <summary>
+ Assert that a string is empty - that is equal to string.Emtpy
+ </summary>
+ <param name="aString">The string to be tested</param>
+ <param name="message">The message to be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotEmpty(System.String)">
+ <summary>
+ Assert that a string is empty - that is equal to string.Emtpy
+ </summary>
+ <param name="aString">The string to be tested</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotEmpty(System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Assert that an array, list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ <param name="message">The message to be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotEmpty(System.Collections.ICollection,System.String)">
+ <summary>
+ Assert that an array, list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ <param name="message">The message to be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotEmpty(System.Collections.ICollection)">
+ <summary>
+ Assert that an array,list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsAssignableFrom(System.Type,System.Object)">
+ <summary>
+ Asserts that an object may be assigned a value of a given Type.
+ </summary>
+ <param name="expected">The expected Type.</param>
+ <param name="actual">The object under examination</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsAssignableFrom(System.Type,System.Object,System.String)">
+ <summary>
+ Asserts that an object may be assigned a value of a given Type.
+ </summary>
+ <param name="expected">The expected Type.</param>
+ <param name="actual">The object under examination</param>
+ <param name="message">The messge to display in case of failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsAssignableFrom(System.Type,System.Object,System.String,System.Object[])">
+ <summary>
+ Asserts that an object may be assigned a value of a given Type.
+ </summary>
+ <param name="expected">The expected Type.</param>
+ <param name="actual">The object under examination</param>
+ <param name="message">The message to display in case of failure</param>
+ <param name="args">Array of objects to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotAssignableFrom(System.Type,System.Object)">
+ <summary>
+ Asserts that an object may not be assigned a value of a given Type.
+ </summary>
+ <param name="expected">The expected Type.</param>
+ <param name="actual">The object under examination</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotAssignableFrom(System.Type,System.Object,System.String)">
+ <summary>
+ Asserts that an object may not be assigned a value of a given Type.
+ </summary>
+ <param name="expected">The expected Type.</param>
+ <param name="actual">The object under examination</param>
+ <param name="message">The messge to display in case of failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotAssignableFrom(System.Type,System.Object,System.String,System.Object[])">
+ <summary>
+ Asserts that an object may not be assigned a value of a given Type.
+ </summary>
+ <param name="expected">The expected Type.</param>
+ <param name="actual">The object under examination</param>
+ <param name="message">The message to display in case of failure</param>
+ <param name="args">Array of objects to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsInstanceOfType(System.Type,System.Object)">
+ <summary>
+ Asserts that an object is an instance of a given type.
+ </summary>
+ <param name="expected">The expected Type</param>
+ <param name="actual">The object being examined</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsInstanceOfType(System.Type,System.Object,System.String)">
+ <summary>
+ Asserts that an object is an instance of a given type.
+ </summary>
+ <param name="expected">The expected Type</param>
+ <param name="actual">The object being examined</param>
+ <param name="message">A message to display in case of failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsInstanceOfType(System.Type,System.Object,System.String,System.Object[])">
+ <summary>
+ Asserts that an object is an instance of a given type.
+ </summary>
+ <param name="expected">The expected Type</param>
+ <param name="actual">The object being examined</param>
+ <param name="message">A message to display in case of failure</param>
+ <param name="args">An array of objects to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotInstanceOfType(System.Type,System.Object)">
+ <summary>
+ Asserts that an object is not an instance of a given type.
+ </summary>
+ <param name="expected">The expected Type</param>
+ <param name="actual">The object being examined</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotInstanceOfType(System.Type,System.Object,System.String)">
+ <summary>
+ Asserts that an object is not an instance of a given type.
+ </summary>
+ <param name="expected">The expected Type</param>
+ <param name="actual">The object being examined</param>
+ <param name="message">A message to display in case of failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.IsNotInstanceOfType(System.Type,System.Object,System.String,System.Object[])">
+ <summary>
+ Asserts that an object is not an instance of a given type.
+ </summary>
+ <param name="expected">The expected Type</param>
+ <param name="actual">The object being examined</param>
+ <param name="message">A message to display in case of failure</param>
+ <param name="args">An array of objects to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Int32,System.Int32,System.String,System.Object[])">
+ <summary>
+ Verifies that two ints are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Int32,System.Int32,System.String)">
+ <summary>
+ Verifies that two ints are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Int32,System.Int32)">
+ <summary>
+ Verifies that two ints are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Int64,System.Int64,System.String,System.Object[])">
+ <summary>
+ Verifies that two longs are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Int64,System.Int64,System.String)">
+ <summary>
+ Verifies that two longs are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Int64,System.Int64)">
+ <summary>
+ Verifies that two longs are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.UInt32,System.UInt32,System.String,System.Object[])">
+ <summary>
+ Verifies that two uints are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.UInt32,System.UInt32,System.String)">
+ <summary>
+ Verifies that two uints are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.UInt32,System.UInt32)">
+ <summary>
+ Verifies that two uints are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.UInt64,System.UInt64,System.String,System.Object[])">
+ <summary>
+ Verifies that two ulongs are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.UInt64,System.UInt64,System.String)">
+ <summary>
+ Verifies that two ulongs are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.UInt64,System.UInt64)">
+ <summary>
+ Verifies that two ulongs are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Decimal,System.Decimal,System.String,System.Object[])">
+ <summary>
+ Verifies that two decimals are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Decimal,System.Decimal,System.String)">
+ <summary>
+ Verifies that two decimal are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Decimal,System.Decimal)">
+ <summary>
+ Verifies that two decimals are equal. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Double,System.Double,System.Double,System.String,System.Object[])">
+ <summary>
+ Verifies that two doubles are equal considering a delta. If the
+ expected value is infinity then the delta value is ignored. If
+ they are not equals then an <see cref="T:NUnit.Framework.AssertionException"/> is
+ thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="delta">The maximum acceptable difference between the
+ the expected and the actual</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Double,System.Double,System.Double,System.String)">
+ <summary>
+ Verifies that two doubles are equal considering a delta. If the
+ expected value is infinity then the delta value is ignored. If
+ they are not equals then an <see cref="T:NUnit.Framework.AssertionException"/> is
+ thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="delta">The maximum acceptable difference between the
+ the expected and the actual</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Double,System.Double,System.Double)">
+ <summary>
+ Verifies that two doubles are equal considering a delta. If the
+ expected value is infinity then the delta value is ignored. If
+ they are not equals then an <see cref="T:NUnit.Framework.AssertionException"/> is
+ thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="delta">The maximum acceptable difference between the
+ the expected and the actual</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Single,System.Single,System.Single,System.String,System.Object[])">
+ <summary>
+ Verifies that two floats are equal considering a delta. If the
+ expected value is infinity then the delta value is ignored. If
+ they are not equals then an <see cref="T:NUnit.Framework.AssertionException"/> is
+ thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="delta">The maximum acceptable difference between the
+ the expected and the actual</param>
+ <param name="message">The message displayed upon failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Single,System.Single,System.Single,System.String)">
+ <summary>
+ Verifies that two floats are equal considering a delta. If the
+ expected value is infinity then the delta value is ignored. If
+ they are not equals then an <see cref="T:NUnit.Framework.AssertionException"/> is
+ thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="delta">The maximum acceptable difference between the
+ the expected and the actual</param>
+ <param name="message">The message displayed upon failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Single,System.Single,System.Single)">
+ <summary>
+ Verifies that two floats are equal considering a delta. If the
+ expected value is infinity then the delta value is ignored. If
+ they are not equals then an <see cref="T:NUnit.Framework.AssertionException"/> is
+ thrown.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="delta">The maximum acceptable difference between the
+ the expected and the actual</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Object,System.Object,System.String,System.Object[])">
+ <summary>
+ Verifies that two objects are equal. Two objects are considered
+ equal if both are null, or if both have the same value. All
+ non-numeric types are compared by using the <c>Equals</c> method.
+ Arrays are compared by comparing each element using the same rules.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The value that is expected</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message to display if objects are not equal</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Object,System.Object,System.String)">
+ <summary>
+ Verifies that two objects are equal. Two objects are considered
+ equal if both are null, or if both have the same value. All
+ non-numeric types are compared by using the <c>Equals</c> method.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The value that is expected</param>
+ <param name="actual">The actual value</param>
+ <param name="message">The message to display if objects are not equal</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreEqual(System.Object,System.Object)">
+ <summary>
+ Verifies that two objects are equal. Two objects are considered
+ equal if both are null, or if both have the same value. All
+ non-numeric types are compared by using the <c>Equals</c> method.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The value that is expected</param>
+ <param name="actual">The actual value</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Object,System.Object,System.String,System.Object[])">
+ <summary>
+ Asserts that two objects are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the two objects are the same object.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Object,System.Object,System.String)">
+ <summary>
+ Asserts that two objects are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the objects are the same</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Object,System.Object)">
+ <summary>
+ Asserts that two objects are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Int32,System.Int32,System.String,System.Object[])">
+ <summary>
+ Asserts that two ints are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the two objects are the same object.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Int32,System.Int32,System.String)">
+ <summary>
+ Asserts that two ints are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the objects are the same</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Int32,System.Int32)">
+ <summary>
+ Asserts that two ints are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Int64,System.Int64,System.String,System.Object[])">
+ <summary>
+ Asserts that two longss are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the two objects are the same object.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Int64,System.Int64,System.String)">
+ <summary>
+ Asserts that two longs are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the objects are the same</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Int64,System.Int64)">
+ <summary>
+ Asserts that two longs are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.UInt32,System.UInt32,System.String,System.Object[])">
+ <summary>
+ Asserts that two uints are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the two objects are the same object.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.UInt32,System.UInt32,System.String)">
+ <summary>
+ Asserts that two uints are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the objects are the same</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.UInt32,System.UInt32)">
+ <summary>
+ Asserts that two uints are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.UInt64,System.UInt64,System.String,System.Object[])">
+ <summary>
+ Asserts that two ulongs are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the two objects are the same object.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.UInt64,System.UInt64,System.String)">
+ <summary>
+ Asserts that two ulongs are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the objects are the same</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.UInt64,System.UInt64)">
+ <summary>
+ Asserts that two ulong are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Decimal,System.Decimal,System.String,System.Object[])">
+ <summary>
+ Asserts that two decimals are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the two objects are the same object.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Decimal,System.Decimal,System.String)">
+ <summary>
+ Asserts that two decimals are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the objects are the same</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Decimal,System.Decimal)">
+ <summary>
+ Asserts that two decimals are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Single,System.Single,System.String,System.Object[])">
+ <summary>
+ Asserts that two floats are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the two objects are the same object.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Single,System.Single,System.String)">
+ <summary>
+ Asserts that two floats are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the objects are the same</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Single,System.Single)">
+ <summary>
+ Asserts that two floats are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Double,System.Double,System.String,System.Object[])">
+ <summary>
+ Asserts that two doubles are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the two objects are the same object.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Double,System.Double,System.String)">
+ <summary>
+ Asserts that two doubles are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the objects are the same</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotEqual(System.Double,System.Double)">
+ <summary>
+ Asserts that two doubles are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreSame(System.Object,System.Object,System.String,System.Object[])">
+ <summary>
+ Asserts that two objects refer to the same object. If they
+ are not the same an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the two objects are not the same object.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreSame(System.Object,System.Object,System.String)">
+ <summary>
+ Asserts that two objects refer to the same object. If they
+ are not the same an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the object is null</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreSame(System.Object,System.Object)">
+ <summary>
+ Asserts that two objects refer to the same object. If they
+ are not the same an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotSame(System.Object,System.Object,System.String,System.Object[])">
+ <summary>
+ Asserts that two objects do not refer to the same object. If they
+ are the same an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the two objects are the same object.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotSame(System.Object,System.Object,System.String)">
+ <summary>
+ Asserts that two objects do not refer to the same object. If they
+ are the same an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ <param name="message">The message to be displayed when the objects are the same</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.AreNotSame(System.Object,System.Object)">
+ <summary>
+ Asserts that two objects do not refer to the same object. If they
+ are the same an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The actual object</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Int32,System.Int32,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Int32,System.Int32,System.String)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Int32,System.Int32)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.UInt32,System.UInt32,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.UInt32,System.UInt32,System.String)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.UInt32,System.UInt32)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Int64,System.Int64,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Int64,System.Int64,System.String)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Int64,System.Int64)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.UInt64,System.UInt64,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.UInt64,System.UInt64,System.String)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.UInt64,System.UInt64)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Decimal,System.Decimal,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Decimal,System.Decimal,System.String)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Decimal,System.Decimal)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Double,System.Double,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Double,System.Double,System.String)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Double,System.Double)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Single,System.Single,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Single,System.Single,System.String)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.Single,System.Single)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.IComparable,System.IComparable,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.IComparable,System.IComparable,System.String)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Greater(System.IComparable,System.IComparable)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Int32,System.Int32,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Int32,System.Int32,System.String)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Int32,System.Int32)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.UInt32,System.UInt32,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.UInt32,System.UInt32,System.String)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.UInt32,System.UInt32)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Int64,System.Int64,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Int64,System.Int64,System.String)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Int64,System.Int64)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.UInt64,System.UInt64,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.UInt64,System.UInt64,System.String)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.UInt64,System.UInt64)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Decimal,System.Decimal,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Decimal,System.Decimal,System.String)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Decimal,System.Decimal)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Double,System.Double,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Double,System.Double,System.String)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Double,System.Double)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Single,System.Single,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Single,System.Single,System.String)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.Single,System.Single)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.IComparable,System.IComparable,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.IComparable,System.IComparable,System.String)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Less(System.IComparable,System.IComparable)">
+ <summary>
+ Verifies that the first value is less than the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Contains(System.Object,System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Asserts that an object is contained in a list.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The list to be examined</param>
+ <param name="message">The message to display in case of failure</param>
+ <param name="args">Arguments used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Contains(System.Object,System.Collections.ICollection,System.String)">
+ <summary>
+ Asserts that an object is contained in a list.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The list to be examined</param>
+ <param name="message">The message to display in case of failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Contains(System.Object,System.Collections.ICollection)">
+ <summary>
+ Asserts that an object is contained in a list.
+ </summary>
+ <param name="expected">The expected object</param>
+ <param name="actual">The list to be examined</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Fail(System.String,System.Object[])">
+ <summary>
+ Throws an <see cref="T:NUnit.Framework.AssertionException"/> with the message and arguments
+ that are passed in. This is used by the other Assert functions.
+ </summary>
+ <param name="message">The message to initialize the <see cref="T:NUnit.Framework.AssertionException"/> with.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Fail(System.String)">
+ <summary>
+ Throws an <see cref="T:NUnit.Framework.AssertionException"/> with the message that is
+ passed in. This is used by the other Assert functions.
+ </summary>
+ <param name="message">The message to initialize the <see cref="T:NUnit.Framework.AssertionException"/> with.</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Fail">
+ <summary>
+ Throws an <see cref="T:NUnit.Framework.AssertionException"/>.
+ This is used by the other Assert functions.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Ignore(System.String,System.Object[])">
+ <summary>
+ Throws an <see cref="T:NUnit.Framework.IgnoreException"/> with the message and arguments
+ that are passed in. This causes the test to be reported as ignored.
+ </summary>
+ <param name="message">The message to initialize the <see cref="T:NUnit.Framework.AssertionException"/> with.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Ignore(System.String)">
+ <summary>
+ Throws an <see cref="T:NUnit.Framework.IgnoreException"/> with the message that is
+ passed in. This causes the test to be reported as ignored.
+ </summary>
+ <param name="message">The message to initialize the <see cref="T:NUnit.Framework.AssertionException"/> with.</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.Ignore">
+ <summary>
+ Throws an <see cref="T:NUnit.Framework.IgnoreException"/>.
+ This causes the test to be reported as ignored.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Assert.DoAssert(NUnit.Framework.IAsserter)">
+ <summary>
+ NOTE: The use of asserters for extending NUnit has
+ now been replaced by the use of constraints. This
+ method is marked obsolete.
+
+ Test the condition asserted by an asserter and throw
+ an assertion exception using provided message on failure.
+ </summary>
+ <param name="asserter">An object that implements IAsserter</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.That(System.Object,NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Apply a constraint to an actual value, succeeding if the constraint
+ is satisfied and throwing an assertion exception on failure.
+ </summary>
+ <param name="constraint">A Constraint to be applied</param>
+ <param name="actual">The actual value to test</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.That(System.Object,NUnit.Framework.Constraints.Constraint,System.String)">
+ <summary>
+ Apply a constraint to an actual value, succeedingt if the constraint
+ is satisfied and throwing an assertion exception on failure.
+ </summary>
+ <param name="constraint">A Constraint to be applied</param>
+ <param name="actual">The actual value to test</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.That(System.Object,NUnit.Framework.Constraints.Constraint,System.String,System.Object[])">
+ <summary>
+ Apply a constraint to an actual value, succeedingt if the constraint
+ is satisfied and throwing an assertion exception on failure.
+ </summary>
+ <param name="constraint">A Constraint to be applied</param>
+ <param name="actual">The actual value to test</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.That(System.Boolean,System.String,System.Object[])">
+ <summary>
+ Asserts that a condition is true. If the condition is false the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ <param name="message">The message to display if the condition is false</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.That(System.Boolean,System.String)">
+ <summary>
+ Asserts that a condition is true. If the condition is false the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ <param name="message">The message to display if the condition is false</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.That(System.Boolean)">
+ <summary>
+ Asserts that a condition is true. If the condition is false the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Int32,System.Int32,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Int32,System.Int32,System.String)">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Int32,System.Int32)">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt32,System.UInt32,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt32,System.UInt32,System.String)">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt32,System.UInt32)">
+ <summary>
+ Verifies that the first value is greater or equal to than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Int64,System.Int64,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Int64,System.Int64,System.String)">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Int64,System.Int64)">
+ <summary>
+ Verifies that the first value is greater or equal to than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt64,System.UInt64,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt64,System.UInt64,System.String)">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.UInt64,System.UInt64)">
+ <summary>
+ Verifies that the first value is greater or equal to than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Decimal,System.Decimal,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Decimal,System.Decimal,System.String)">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Decimal,System.Decimal)">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Double,System.Double,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Double,System.Double,System.String)">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Double,System.Double)">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Single,System.Single,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Single,System.Single,System.String)">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.Single,System.Single)">
+ <summary>
+ Verifies that the first value is greater than or equal to the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.IComparable,System.IComparable,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.IComparable,System.IComparable,System.String)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.GreaterOrEqual(System.IComparable,System.IComparable)">
+ <summary>
+ Verifies that the first value is greater than the second
+ value. If they are not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be greater</param>
+ <param name="arg2">The second value, expected to be less</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Int32,System.Int32,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Int32,System.Int32,System.String)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Int32,System.Int32)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.UInt32,System.UInt32,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.UInt32,System.UInt32,System.String)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.UInt32,System.UInt32)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Int64,System.Int64,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Int64,System.Int64,System.String)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Int64,System.Int64)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.UInt64,System.UInt64,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.UInt64,System.UInt64,System.String)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.UInt64,System.UInt64)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Decimal,System.Decimal,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Decimal,System.Decimal,System.String)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Decimal,System.Decimal)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Double,System.Double,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Double,System.Double,System.String)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Double,System.Double)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Single,System.Single,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Single,System.Single,System.String)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.Single,System.Single)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.IComparable,System.IComparable,System.String,System.Object[])">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.IComparable,System.IComparable,System.String)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.Assert.LessOrEqual(System.IComparable,System.IComparable)">
+ <summary>
+ Verifies that the first value is less than or equal to the second
+ value. If it is not, then an
+ <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="arg1">The first value, expected to be less</param>
+ <param name="arg2">The second value, expected to be greater</param>
+ </member>
+ <member name="P:NUnit.Framework.Assert.Counter">
+ <summary>
+ Gets the number of assertions executed so far and
+ resets the counter to zero.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.MessageMatch">
+ <summary>
+ Enumeration indicating how the expected message parameter is to be used
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.MessageMatch.Exact">
+ Expect an exact match
+ </member>
+ <member name="F:NUnit.Framework.MessageMatch.Contains">
+ Expect a message containing the parameter string
+ </member>
+ <member name="F:NUnit.Framework.MessageMatch.Regex">
+ Match the regular expression provided as a parameter
+ </member>
+ <member name="T:NUnit.Framework.ExpectedExceptionAttribute">
+ <summary>
+ ExpectedExceptionAttribute
+ </summary>
+
+ </member>
+ <member name="M:NUnit.Framework.ExpectedExceptionAttribute.#ctor">
+ <summary>
+ Constructor for a non-specific exception
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.ExpectedExceptionAttribute.#ctor(System.Type)">
+ <summary>
+ Constructor for a given type of exception
+ </summary>
+ <param name="exceptionType">The type of the expected exception</param>
+ </member>
+ <member name="M:NUnit.Framework.ExpectedExceptionAttribute.#ctor(System.String)">
+ <summary>
+ Constructor for a given exception name
+ </summary>
+ <param name="exceptionName">The full name of the expected exception</param>
+ </member>
+ <member name="M:NUnit.Framework.ExpectedExceptionAttribute.#ctor(System.Type,System.String)">
+ <summary>
+ Constructor for a given type of exception and expected message text
+ </summary>
+ <param name="exceptionType">The type of the expected exception</param>
+ <param name="expectedMessage">The expected message text</param>
+ </member>
+ <member name="M:NUnit.Framework.ExpectedExceptionAttribute.#ctor(System.String,System.String)">
+ <summary>
+ Constructor for a given exception name and expected message text
+ </summary>
+ <param name="exceptionName">The full name of the expected exception</param>
+ <param name="expectedMessage">The expected messge text</param>
+ </member>
+ <member name="P:NUnit.Framework.ExpectedExceptionAttribute.ExceptionType">
+ <summary>
+ Gets or sets the expected exception type
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.ExpectedExceptionAttribute.ExceptionName">
+ <summary>
+ Gets or sets the full Type name of the expected exception
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.ExpectedExceptionAttribute.ExpectedMessage">
+ <summary>
+ Gets or sets the expected message text
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.ExpectedExceptionAttribute.UserMessage">
+ <summary>
+ Gets or sets the user message displayed in case of failure
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.ExpectedExceptionAttribute.MatchType">
+ <summary>
+ Gets or sets the type of match to be performed on the expected message
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.ExpectedExceptionAttribute.Handler">
+ <summary>
+ Gets the name of a method to be used as an exception handler
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.CollectionAssert">
+ <summary>
+ A set of Assert methods operationg on one or more collections
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.Equals(System.Object,System.Object)">
+ <summary>
+ The Equals method throws an AssertionException. This is done
+ to make sure there is no mistake by calling this function.
+ </summary>
+ <param name="a"></param>
+ <param name="b"></param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.ReferenceEquals(System.Object,System.Object)">
+ <summary>
+ override the default ReferenceEquals to throw an AssertionException. This
+ implementation makes sure there is no mistake in calling this function
+ as part of Assert.
+ </summary>
+ <param name="a"></param>
+ <param name="b"></param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AllItemsAreInstancesOfType(System.Collections.ICollection,System.Type)">
+ <summary>
+ Asserts that all items contained in collection are of the type specified by expectedType.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="expectedType">System.Type that all objects in collection must be instances of</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AllItemsAreInstancesOfType(System.Collections.ICollection,System.Type,System.String)">
+ <summary>
+ Asserts that all items contained in collection are of the type specified by expectedType.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="expectedType">System.Type that all objects in collection must be instances of</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AllItemsAreInstancesOfType(System.Collections.ICollection,System.Type,System.String,System.Object[])">
+ <summary>
+ Asserts that all items contained in collection are of the type specified by expectedType.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="expectedType">System.Type that all objects in collection must be instances of</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AllItemsAreNotNull(System.Collections.ICollection)">
+ <summary>
+ Asserts that all items contained in collection are not equal to null.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AllItemsAreNotNull(System.Collections.ICollection,System.String)">
+ <summary>
+ Asserts that all items contained in collection are not equal to null.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AllItemsAreNotNull(System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Asserts that all items contained in collection are not equal to null.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AllItemsAreUnique(System.Collections.ICollection)">
+ <summary>
+ Ensures that every object contained in collection exists within the collection
+ once and only once.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AllItemsAreUnique(System.Collections.ICollection,System.String)">
+ <summary>
+ Ensures that every object contained in collection exists within the collection
+ once and only once.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AllItemsAreUnique(System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Ensures that every object contained in collection exists within the collection
+ once and only once.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.ICollection,System.Collections.ICollection)">
+ <summary>
+ Asserts that expected and actual are exactly equal. The collections must have the same count,
+ and contain the exact same objects in the same order.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.ICollection,System.Collections.ICollection,System.Collections.IComparer)">
+ <summary>
+ Asserts that expected and actual are exactly equal. The collections must have the same count,
+ and contain the exact same objects in the same order.
+ If comparer is not null then it will be used to compare the objects.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="comparer">The IComparer to use in comparing objects from each ICollection</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.ICollection,System.Collections.ICollection,System.String)">
+ <summary>
+ Asserts that expected and actual are exactly equal. The collections must have the same count,
+ and contain the exact same objects in the same order.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.ICollection,System.Collections.ICollection,System.Collections.IComparer,System.String)">
+ <summary>
+ Asserts that expected and actual are exactly equal. The collections must have the same count,
+ and contain the exact same objects in the same order.
+ If comparer is not null then it will be used to compare the objects.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="comparer">The IComparer to use in comparing objects from each ICollection</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.ICollection,System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Asserts that expected and actual are exactly equal. The collections must have the same count,
+ and contain the exact same objects in the same order.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreEqual(System.Collections.ICollection,System.Collections.ICollection,System.Collections.IComparer,System.String,System.Object[])">
+ <summary>
+ Asserts that expected and actual are exactly equal. The collections must have the same count,
+ and contain the exact same objects in the same order.
+ If comparer is not null then it will be used to compare the objects.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="comparer">The IComparer to use in comparing objects from each ICollection</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreEquivalent(System.Collections.ICollection,System.Collections.ICollection)">
+ <summary>
+ Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreEquivalent(System.Collections.ICollection,System.Collections.ICollection,System.String)">
+ <summary>
+ Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreEquivalent(System.Collections.ICollection,System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.ICollection,System.Collections.ICollection)">
+ <summary>
+ Asserts that expected and actual are not exactly equal.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.ICollection,System.Collections.ICollection,System.Collections.IComparer)">
+ <summary>
+ Asserts that expected and actual are not exactly equal.
+ If comparer is not null then it will be used to compare the objects.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="comparer">The IComparer to use in comparing objects from each ICollection</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.ICollection,System.Collections.ICollection,System.String)">
+ <summary>
+ Asserts that expected and actual are not exactly equal.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.ICollection,System.Collections.ICollection,System.Collections.IComparer,System.String)">
+ <summary>
+ Asserts that expected and actual are not exactly equal.
+ If comparer is not null then it will be used to compare the objects.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="comparer">The IComparer to use in comparing objects from each ICollection</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.ICollection,System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Asserts that expected and actual are not exactly equal.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreNotEqual(System.Collections.ICollection,System.Collections.ICollection,System.Collections.IComparer,System.String,System.Object[])">
+ <summary>
+ Asserts that expected and actual are not exactly equal.
+ If comparer is not null then it will be used to compare the objects.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="comparer">The IComparer to use in comparing objects from each ICollection</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreNotEquivalent(System.Collections.ICollection,System.Collections.ICollection)">
+ <summary>
+ Asserts that expected and actual are not equivalent.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreNotEquivalent(System.Collections.ICollection,System.Collections.ICollection,System.String)">
+ <summary>
+ Asserts that expected and actual are not equivalent.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.AreNotEquivalent(System.Collections.ICollection,System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Asserts that expected and actual are not equivalent.
+ </summary>
+ <param name="expected">The first ICollection of objects to be considered</param>
+ <param name="actual">The second ICollection of objects to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.Contains(System.Collections.ICollection,System.Object)">
+ <summary>
+ Asserts that collection contains actual as an item.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="actual">Object to be found within collection</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.Contains(System.Collections.ICollection,System.Object,System.String)">
+ <summary>
+ Asserts that collection contains actual as an item.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="actual">Object to be found within collection</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.Contains(System.Collections.ICollection,System.Object,System.String,System.Object[])">
+ <summary>
+ Asserts that collection contains actual as an item.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="actual">Object to be found within collection</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.DoesNotContain(System.Collections.ICollection,System.Object)">
+ <summary>
+ Asserts that collection does not contain actual as an item.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="actual">Object that cannot exist within collection</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.DoesNotContain(System.Collections.ICollection,System.Object,System.String)">
+ <summary>
+ Asserts that collection does not contain actual as an item.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="actual">Object that cannot exist within collection</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.DoesNotContain(System.Collections.ICollection,System.Object,System.String,System.Object[])">
+ <summary>
+ Asserts that collection does not contain actual as an item.
+ </summary>
+ <param name="collection">ICollection of objects to be considered</param>
+ <param name="actual">Object that cannot exist within collection</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsNotSubsetOf(System.Collections.ICollection,System.Collections.ICollection)">
+ <summary>
+ Asserts that superset is not a subject of subset.
+ </summary>
+ <param name="subset">The ICollection superset to be considered</param>
+ <param name="superset">The ICollection subset to be considered</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsNotSubsetOf(System.Collections.ICollection,System.Collections.ICollection,System.String)">
+ <summary>
+ Asserts that superset is not a subject of subset.
+ </summary>
+ <param name="subset">The ICollection superset to be considered</param>
+ <param name="superset">The ICollection subset to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsNotSubsetOf(System.Collections.ICollection,System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Asserts that superset is not a subject of subset.
+ </summary>
+ <param name="subset">The ICollection superset to be considered</param>
+ <param name="superset">The ICollection subset to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsSubsetOf(System.Collections.ICollection,System.Collections.ICollection)">
+ <summary>
+ Asserts that superset is a subset of subset.
+ </summary>
+ <param name="subset">The ICollection superset to be considered</param>
+ <param name="superset">The ICollection subset to be considered</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsSubsetOf(System.Collections.ICollection,System.Collections.ICollection,System.String)">
+ <summary>
+ Asserts that superset is a subset of subset.
+ </summary>
+ <param name="subset">The ICollection superset to be considered</param>
+ <param name="superset">The ICollection subset to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsSubsetOf(System.Collections.ICollection,System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Asserts that superset is a subset of subset.
+ </summary>
+ <param name="subset">The ICollection superset to be considered</param>
+ <param name="superset">The ICollection subset to be considered</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsEmpty(System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Assert that an array, list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ <param name="message">The message to be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsEmpty(System.Collections.ICollection,System.String)">
+ <summary>
+ Assert that an array, list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ <param name="message">The message to be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsEmpty(System.Collections.ICollection)">
+ <summary>
+ Assert that an array,list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsNotEmpty(System.Collections.ICollection,System.String,System.Object[])">
+ <summary>
+ Assert that an array, list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ <param name="message">The message to be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsNotEmpty(System.Collections.ICollection,System.String)">
+ <summary>
+ Assert that an array, list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ <param name="message">The message to be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.CollectionAssert.IsNotEmpty(System.Collections.ICollection)">
+ <summary>
+ Assert that an array,list or other collection is empty
+ </summary>
+ <param name="collection">An array, list or other collection implementing ICollection</param>
+ </member>
+ <member name="T:NUnit.Framework.AbstractAsserter">
+ <summary>
+ NOTE: The use of asserters for extending NUnit has
+ now been replaced by the use of constraints. This
+ class is marked obsolete.
+
+ AbstractAsserter is the base class for all asserters.
+ Asserters encapsulate a condition test and generation
+ of an AssertionException with a tailored message. They
+ are used by the Assert class as helper objects.
+
+ User-defined asserters may be passed to the
+ Assert.DoAssert method in order to implement
+ extended asserts.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.IAsserter">
+ <summary>
+ NOTE: The use of asserters for extending NUnit has
+ now been replaced by the use of constraints. This
+ interface is marked obsolete.
+
+ The interface implemented by an asserter. Asserters
+ encapsulate a condition test and generation of an
+ AssertionException with a tailored message. They
+ are used by the Assert class as helper objects.
+
+ User-defined asserters may be passed to the
+ Assert.DoAssert method in order to implement
+ extended asserts.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.IAsserter.Test">
+ <summary>
+ Test the condition for the assertion.
+ </summary>
+ <returns>True if the test succeeds</returns>
+ </member>
+ <member name="P:NUnit.Framework.IAsserter.Message">
+ <summary>
+ Return the message giving the failure reason.
+ The return value is unspecified if no failure
+ has occured.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.AbstractAsserter.userMessage">
+ <summary>
+ The user-defined message for this asserter.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.AbstractAsserter.args">
+ <summary>
+ Arguments to use in formatting the user-defined message.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.AbstractAsserter.failureMessage">
+ <summary>
+ Our failure message object, initialized as needed
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.AbstractAsserter.#ctor(System.String,System.Object[])">
+ <summary>
+ Constructs an AbstractAsserter
+ </summary>
+ <param name="message">The message issued upon failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.AbstractAsserter.Test">
+ <summary>
+ Test method to be implemented by derived types.
+ Default always succeeds.
+ </summary>
+ <returns>True if the test succeeds</returns>
+ </member>
+ <member name="P:NUnit.Framework.AbstractAsserter.FailureMessage">
+ <summary>
+ AssertionFailureMessage object used internally
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.AbstractAsserter.Message">
+ <summary>
+ Message related to a failure. If no failure has
+ occured, the result is unspecified.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.Assertion">
+ <summary>
+ The Assertion class is obsolete and has been
+ replaced by the Assert class.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.Assert(System.String,System.Boolean)">
+ <summary>
+ Asserts that a condition is true. If it isn't it throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>.
+ </summary>
+ <param name="message">The message to display is the condition
+ is false</param>
+ <param name="condition">The evaluated condition</param>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.Assert(System.Boolean)">
+ <summary>
+ Asserts that a condition is true. If it isn't it throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertEquals(System.Double,System.Double,System.Double)">
+ <summary>
+ /// Asserts that two doubles are equal concerning a delta. If the
+ expected value is infinity then the delta value is ignored.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="delta">The maximum acceptable difference between the
+ the expected and the actual</param>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertEquals(System.Single,System.Single,System.Single)">
+ <summary>
+ /// Asserts that two singles are equal concerning a delta. If the
+ expected value is infinity then the delta value is ignored.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="delta">The maximum acceptable difference between the
+ the expected and the actual</param>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertEquals(System.Object,System.Object)">
+ <summary>Asserts that two objects are equal. If they are not
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.</summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertEquals(System.Int32,System.Int32)">
+ <summary>Asserts that two ints are equal. If they are not
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.</summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertEquals(System.String,System.Int32,System.Int32)">
+ <summary>Asserts that two ints are equal. If they are not
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.</summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertEquals(System.String,System.Double,System.Double,System.Double)">
+ <summary>Asserts that two doubles are equal concerning a delta.
+ If the expected value is infinity then the delta value is ignored.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertEquals(System.String,System.Single,System.Single,System.Single)">
+ <summary>Asserts that two floats are equal concerning a delta.
+ If the expected value is infinity then the delta value is ignored.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertEquals(System.String,System.Object,System.Object)">
+ <summary>
+ Asserts that two objects are equal. Two objects are considered
+ equal if both are null, or if both have the same value. Numeric
+ types are compared via string comparision on their contents to
+ avoid problems comparing values between different types. All
+ non-numeric types are compared by using the <c>Equals</c> method.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertNotNull(System.Object)">
+ <summary>Asserts that an object isn't null.</summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertNotNull(System.String,System.Object)">
+ <summary>Asserts that an object isn't null.</summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertNull(System.Object)">
+ <summary>Asserts that an object is null.</summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertNull(System.String,System.Object)">
+ <summary>Asserts that an object is null.</summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertSame(System.Object,System.Object)">
+ <summary>Asserts that two objects refer to the same object. If they
+ are not the same an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.AssertSame(System.String,System.Object,System.Object)">
+ <summary>Asserts that two objects refer to the same object.
+ If they are not an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.Fail">
+ <summary>Fails a test with no message.</summary>
+ </member>
+ <member name="M:NUnit.Framework.Assertion.Fail(System.String)">
+ <summary>Fails a test with the given message.</summary>
+ </member>
+ <member name="T:NUnit.Framework.AssertionException">
+ <summary>
+ Thrown when an assertion failed.
+ </summary>
+
+ </member>
+ <member name="M:NUnit.Framework.AssertionException.#ctor(System.String)">
+ <param name="message">The error message that explains
+ the reason for the exception</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionException.#ctor(System.String,System.Exception)">
+ <param name="message">The error message that explains
+ the reason for the exception</param>
+ <param name="inner">The exception that caused the
+ current exception</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
+ <summary>
+ Serialization Constructor
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.AssertionFailureMessage">
+ <summary>
+ AssertionFailureMessage encapsulates a failure message
+ issued as a result of an Assert failure.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.AssertionFailureMessage.PreClipLength">
+ <summary>
+ Number of characters before a highlighted position before
+ clipping will occur. Clipped text is replaced with an
+ elipsis "..."
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.AssertionFailureMessage.PostClipLength">
+ <summary>
+ Number of characters after a highlighted position before
+ clipping will occur. Clipped text is replaced with an
+ elipsis "..."
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.AssertionFailureMessage.expectedPrefix">
+ <summary>
+ Prefix used to start an expected value line.
+ Must be same length as actualPrefix.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.AssertionFailureMessage.actualPrefix">
+ <summary>
+ Prefix used to start an actual value line.
+ Must be same length as expectedPrefix.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.#ctor(System.String,System.Object[])">
+ <summary>
+ Construct an AssertionFailureMessage with a message
+ and optional arguments.
+ </summary>
+ <param name="message"></param>
+ <param name="args"></param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.#ctor">
+ <summary>
+ Construct an empty AssertionFailureMessage
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.WriteExpectedLine(System.String)">
+ <summary>
+ Add an expected value line to the message containing
+ the text provided as an argument.
+ </summary>
+ <param name="text">Text describing what was expected.</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.WriteActualLine(System.String)">
+ <summary>
+ Add an actual value line to the message containing
+ the text provided as an argument.
+ </summary>
+ <param name="text">Text describing the actual value.</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayExpectedValue(System.Object)">
+ <summary>
+ Add an expected value line to the message containing
+ a string representation of the object provided.
+ </summary>
+ <param name="expected">An object representing the expected value</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayExpectedValue(System.Double,System.Double)">
+ <summary>
+ Add an expected value line to the message containing a double
+ and the tolerance used in making the comparison.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="tolerance">The tolerance specified in the Assert</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayActualValue(System.Object)">
+ <summary>
+ Add an actual value line to the message containing
+ a string representation of the object provided.
+ </summary>
+ <param name="actual">An object representing what was actually found</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayExpectedAndActual(System.Object,System.Object)">
+ <summary>
+ Display two lines that communicate the expected value, and the actual value
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value found</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayExpectedAndActual(System.Double,System.Double,System.Double)">
+ <summary>
+ Display two lines that communicate the expected value, the actual value and
+ the tolerance used in comparing two doubles.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value found</param>
+ <param name="tolerance">The tolerance specified in the Assert</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayPositionMarker(System.Int32)">
+ <summary>
+ Draws a marker under the expected/actual strings that highlights
+ where in the string a mismatch occurred.
+ </summary>
+ <param name="iPosition">The position of the mismatch</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.BuildStringLengthReport(System.String,System.String)">
+ <summary>
+ Reports whether the string lengths are the same or different, and
+ what the string lengths are.
+ </summary>
+ <param name="sExpected">The expected string</param>
+ <param name="sActual">The actual string value</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayDifferences(System.Object,System.Object,System.Boolean)">
+ <summary>
+ Called to create additional message lines when two objects have been
+ found to be unequal. If the inputs are strings, a special message is
+ rendered that can help track down where the strings are different,
+ based on differences in length, or differences in content.
+
+ If the inputs are not strings, the ToString method of the objects
+ is used to show what is different about them.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value</param>
+ <param name="caseInsensitive">True if a case-insensitive comparison is being performed</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayDifferencesWithTolerance(System.Double,System.Double,System.Double)">
+ <summary>
+ Called to create additional message lines when two doubles have been
+ found to be unequal, within the specified tolerance.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayStringDifferences(System.String,System.String,System.Boolean)">
+ <summary>
+ Constructs a message that can be displayed when the content of two
+ strings are different, but the string lengths are the same. The
+ message will clip the strings to a reasonable length, centered
+ around the first position where they are mismatched, and draw
+ a line marking the position of the difference to make comparison
+ quicker.
+ </summary>
+ <param name="sExpected">The expected string value</param>
+ <param name="sActual">The actual string value</param>
+ <param name="caseInsensitive">True if a case-insensitive comparison is being performed</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayArrayDifferences(System.Array,System.Array,System.Int32)">
+ <summary>
+ Display a standard message showing the differences found between
+ two arrays that were expected to be equal.
+ </summary>
+ <param name="expected">The expected array value</param>
+ <param name="actual">The actual array value</param>
+ <param name="index">The index at which a difference was found</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayCollectionDifferences(System.Collections.ICollection,System.Collections.ICollection,System.Int32)">
+ <summary>
+ Display a standard message showing the differences found between
+ two collections that were expected to be equal.
+ </summary>
+ <param name="expected">The expected collection value</param>
+ <param name="actual">The actual collection value</param>
+ <param name="index">The index at which a difference was found</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.GetArrayIndicesFromCollectionIndex(System.Collections.ICollection,System.Int32)">
+ <summary>
+ Get an array of indices representing the point in a collection or
+ array corresponding to a single int index into the collection.
+ </summary>
+ <param name="collection">The collection to which the indices apply</param>
+ <param name="index">Index in the collection</param>
+ <returns>Array of indices</returns>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.DisplayListElements(System.String,System.Collections.IList,System.Int32,System.Int32)">
+ <summary>
+ Displays elements from a list 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 list of the first element to display</param>
+ <param name="max">The maximum number of elements to display</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.FormatObjectForDisplay(System.Object)">
+ <summary>
+ Formats an object for display in a message line
+ </summary>
+ <param name="obj">The object to be displayed</param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.InputsAreStrings(System.Object,System.Object)">
+ <summary>
+ Tests two objects to determine if they are strings.
+ </summary>
+ <param name="expected"></param>
+ <param name="actual"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.ClipAroundPosition(System.String,System.Int32)">
+ <summary>
+ Renders up to M characters before, and up to N characters after
+ the specified index position. If leading or trailing text is
+ clipped, and elipses "..." is added where the missing text would
+ be.
+
+ Clips strings to limit previous or post newline characters,
+ since these mess up the comparison
+ </summary>
+ <param name="sString"></param>
+ <param name="iPosition"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.FindMismatchPosition(System.String,System.String,System.Int32)">
+ <summary>
+ Shows the position two strings start to differ. Comparison
+ starts at the start index.
+ </summary>
+ <param name="sExpected"></param>
+ <param name="sActual"></param>
+ <param name="iStart"></param>
+ <returns>-1 if no mismatch found, or the index where mismatch found</returns>
+ </member>
+ <member name="M:NUnit.Framework.AssertionFailureMessage.ConvertWhitespace(System.String)">
+ <summary>
+ Turns CR, LF, or TAB into visual indicator to preserve visual marker
+ position. This is done by replacing the '\r' into '\\' and 'r'
+ characters, and the '\n' into '\\' and 'n' characters, and '\t' into
+ '\\' and 't' characters.
+
+ Thus the single character becomes two characters for display.
+ </summary>
+ <param name="sInput"></param>
+ <returns></returns>
+ </member>
+ <member name="T:NUnit.Framework.CategoryAttribute">
+ <summary>
+ Attribute used to apply a category to a test
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.CategoryAttribute.categoryName">
+ <summary>
+ The name of the category
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.CategoryAttribute.#ctor(System.String)">
+ <summary>
+ Construct attribute for a given category
+ </summary>
+ <param name="name">The name of the category</param>
+ </member>
+ <member name="M:NUnit.Framework.CategoryAttribute.#ctor">
+ <summary>
+ Protected constructor uses the Type name as the name
+ of the category.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.CategoryAttribute.Name">
+ <summary>
+ The name of the category
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.IncludeExcludeAttribute">
+ <summary>
+ Abstract base for Attributes that are used to include tests
+ in the test run based on environmental settings.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.IncludeExcludeAttribute.#ctor">
+ <summary>
+ Constructor with no included items specified, for use
+ with named property syntax.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.IncludeExcludeAttribute.#ctor(System.String)">
+ <summary>
+ Constructor taking one or more included items
+ </summary>
+ <param name="include">Comma-delimited list of included items</param>
+ </member>
+ <member name="P:NUnit.Framework.IncludeExcludeAttribute.Include">
+ <summary>
+ Name of the item that is needed in order for
+ a test to run. Multiple itemss may be given,
+ separated by a comma.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.IncludeExcludeAttribute.Exclude">
+ <summary>
+ Name of the item to be excluded. Multiple items
+ may be given, separated by a comma.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.IncludeExcludeAttribute.Reason">
+ <summary>
+ The reason for including or excluding the test
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.PlatformAttribute">
+ <summary>
+ PlatformAttribute is used to mark a test fixture or an
+ individual method as applying to a particular platform only.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.PlatformAttribute.#ctor">
+ <summary>
+ Constructor with no platforms specified, for use
+ with named property syntax.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.PlatformAttribute.#ctor(System.String)">
+ <summary>
+ Constructor taking one or more platforms
+ </summary>
+ <param name="platforms">Comma-deliminted list of platforms</param>
+ </member>
+ <member name="T:NUnit.Framework.CultureAttribute">
+ <summary>
+ CultureAttribute is used to mark a test fixture or an
+ individual method as applying to a particular Culture only.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.CultureAttribute.#ctor">
+ <summary>
+ Constructor with no cultures specified, for use
+ with named property syntax.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.CultureAttribute.#ctor(System.String)">
+ <summary>
+ Constructor taking one or more cultures
+ </summary>
+ <param name="cultures">Comma-deliminted list of cultures</param>
+ </member>
+ <member name="T:NUnit.Framework.MessageWriter">
+ <summary>
+ MessageWriter is the abstract base for classes that write
+ constraint descriptions and messages in some form. The
+ class has separate methods for writing various components
+ of a message, allowing implementations to tailor the
+ presentation as needed.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.#ctor">
+ <summary>
+ Construct a MessageWriter given a culture
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.WriteMessageLine(System.String,System.Object[])">
+ <summary>
+ Method to write single line message with optional args, usually
+ written to precede the general failure message.
+ </summary>
+ <param name="message">The message to be written</param>
+ <param name="args">Any arguments used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.WriteMessageLine(System.Int32,System.String,System.Object[])">
+ <summary>
+ Method to write single line message with optional args, usually
+ written to precede the general failure message, at a givel
+ indentation level.
+ </summary>
+ <param name="level">The indentation level of the message</param>
+ <param name="message">The message to be written</param>
+ <param name="args">Any arguments used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.DisplayDifferences(NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Display Expected and Actual lines for a constraint. This
+ is called by MessageWriter's default implementation of
+ WriteMessageTo and provides the generic two-line display.
+ </summary>
+ <param name="constraint">The constraint that failed</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.DisplayDifferences(System.Object,System.Object)">
+ <summary>
+ Display Expected and Actual lines for given values. This
+ method may be called by constraints that need more control over
+ the display of actual and expected values than is provided
+ by the default implementation.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value causing the failure</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.DisplayDifferences(System.Object,System.Object,System.Object)">
+ <summary>
+ Display Expected and Actual lines for given values, including
+ a tolerance value on the Expected line.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value causing the failure</param>
+ <param name="tolerance">The tolerance within which the test was made</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.DisplayStringDifferences(System.String,System.String,System.Int32,System.Boolean)">
+ <summary>
+ Display the expected and actual string values on separate lines.
+ If the mismatch parameter is >=0, an additional line is displayed
+ line containing a caret that points to the mismatch point.
+ </summary>
+ <param name="expected">The expected string value</param>
+ <param name="actual">The actual string value</param>
+ <param name="mismatch">The point at which the strings don't match or -1</param>
+ <param name="ignoreCase">If true, case is ignored in locating the point where the strings differ</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.WriteConnector(System.String)">
+ <summary>
+ Writes the text for a connector.
+ </summary>
+ <param name="connector">The connector.</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.WritePredicate(System.String)">
+ <summary>
+ Writes the text for a predicate.
+ </summary>
+ <param name="predicate">The predicate.</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.WriteExpectedValue(System.Object)">
+ <summary>
+ Writes the text for an expected value.
+ </summary>
+ <param name="expected">The expected value.</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.WriteModifier(System.String)">
+ <summary>
+ Writes the text for a modifier
+ </summary>
+ <param name="modifier">The modifier.</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.WriteActualValue(System.Object)">
+ <summary>
+ Writes the text for an actual value.
+ </summary>
+ <param name="actual">The actual value.</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.WriteValue(System.Object)">
+ <summary>
+ Writes the text for a generalized value.
+ </summary>
+ <param name="val">The value.</param>
+ </member>
+ <member name="M:NUnit.Framework.MessageWriter.WriteCollectionElements(System.Collections.ICollection,System.Int32,System.Int32)">
+ <summary>
+ Writes the text for a collection value,
+ starting at a particular point, to a max length
+ </summary>
+ <param name="collection">The collection containing elements to write.</param>
+ <param name="start">The starting point of the elements to write</param>
+ <param name="max">The maximum number of elements to write</param>
+ </member>
+ <member name="P:NUnit.Framework.MessageWriter.MaxLineLength">
+ <summary>
+ Abstract method to get the max line length
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.SetCultureAttribute">
+ <summary>
+ Summary description for SetCultureAttribute.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.PropertyAttribute">
+ <summary>
+ PropertyAttribute is used to attach information to a test as a name/value pair..
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.PropertyAttribute.propertyName">
+ <summary>
+ The property name
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.PropertyAttribute.propertyValue">
+ <summary>
+ The property value
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.PropertyAttribute.#ctor(System.String,System.Object)">
+ <summary>
+ Construct a PropertyAttribute with a name and value
+ </summary>
+ <param name="propertyName">The name of the property</param>
+ <param name="propertyValue">The property value</param>
+ </member>
+ <member name="M:NUnit.Framework.PropertyAttribute.#ctor(System.Object)">
+ <summary>
+ Constructor for use by inherited classes that use the
+ name of the type as the property name.
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.PropertyAttribute.Name">
+ <summary>
+ Gets the property name
+ </summary>
+ </member>
+ <member name="P:NUnit.Framework.PropertyAttribute.Value">
+ <summary>
+ Gets the property value
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.SetCultureAttribute.#ctor(System.String)">
+ <summary>
+ Construct given the name of a culture
+ </summary>
+ <param name="culture"></param>
+ </member>
+ <member name="T:NUnit.Framework.TextMessageWriter">
+ <summary>
+ TextMessageWriter writes constraint descriptions and messages
+ in displayable form as a text stream. It tailors the display
+ of individual message components to form the standard message
+ format of NUnit assertion failure messages.
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.TextMessageWriter.Pfx_Expected">
+ <summary>
+ Prefix used for the expected value line of a message
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.TextMessageWriter.Pfx_Actual">
+ <summary>
+ Prefix used for the actual value line of a message
+ </summary>
+ </member>
+ <member name="F:NUnit.Framework.TextMessageWriter.PrefixLength">
+ <summary>
+ Length of a message prefix
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.#ctor">
+ <summary>
+ Construct a TextMessageWriter
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.#ctor(System.String,System.Object[])">
+ <summary>
+ Construct a TextMessageWriter, specifying a user message
+ and optional formatting arguments.
+ </summary>
+ <param name="userMessage"></param>
+ <param name="args"></param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteMessageLine(System.Int32,System.String,System.Object[])">
+ <summary>
+ Method to write single line message with optional args, usually
+ written to precede the general failure message, at a givel
+ indentation level.
+ </summary>
+ <param name="level">The indentation level of the message</param>
+ <param name="message">The message to be written</param>
+ <param name="args">Any arguments used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.DisplayDifferences(NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Display Expected and Actual lines for a constraint. This
+ is called by MessageWriter's default implementation of
+ WriteMessageTo and provides the generic two-line display.
+ </summary>
+ <param name="constraint">The constraint that failed</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.DisplayDifferences(System.Object,System.Object)">
+ <summary>
+ Display Expected and Actual lines for given values. This
+ method may be called by constraints that need more control over
+ the display of actual and expected values than is provided
+ by the default implementation.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value causing the failure</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.DisplayDifferences(System.Object,System.Object,System.Object)">
+ <summary>
+ Display Expected and Actual lines for given values, including
+ a tolerance value on the expected line.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="actual">The actual value causing the failure</param>
+ <param name="tolerance">The tolerance within which the test was made</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.DisplayStringDifferences(System.String,System.String,System.Int32,System.Boolean)">
+ <summary>
+ Display the expected and actual string values on separate lines.
+ If the mismatch parameter is >=0, an additional line is displayed
+ line containing a caret that points to the mismatch point.
+ </summary>
+ <param name="expected">The expected string value</param>
+ <param name="actual">The actual string value</param>
+ <param name="mismatch">The point at which the strings don't match or -1</param>
+ <param name="ignoreCase">If true, case is ignored in string comparisons</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteConnector(System.String)">
+ <summary>
+ Writes the text for a connector.
+ </summary>
+ <param name="connector">The connector.</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WritePredicate(System.String)">
+ <summary>
+ Writes the text for a predicate.
+ </summary>
+ <param name="predicate">The predicate.</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteModifier(System.String)">
+ <summary>
+ Write the text for a modifier.
+ </summary>
+ <param name="modifier">The modifier.</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteExpectedValue(System.Object)">
+ <summary>
+ Writes the text for an expected value.
+ </summary>
+ <param name="expected">The expected value.</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteActualValue(System.Object)">
+ <summary>
+ Writes the text for an actual value.
+ </summary>
+ <param name="actual">The actual value.</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteValue(System.Object)">
+ <summary>
+ Writes the text for a generalized value.
+ </summary>
+ <param name="val">The value.</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteCollectionElements(System.Collections.ICollection,System.Int32,System.Int32)">
+ <summary>
+ Writes the text for a collection value,
+ starting at a particular point, to a max length
+ </summary>
+ <param name="collection">The collection containing elements to write.</param>
+ <param name="start">The starting point of the elements to write</param>
+ <param name="max">The maximum number of elements to write</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteExpectedLine(NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Write the generic 'Expected' line for a constraint
+ </summary>
+ <param name="constraint">The constraint that failed</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteExpectedLine(System.Object)">
+ <summary>
+ Write the generic 'Expected' line for a given value
+ </summary>
+ <param name="expected">The expected value</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteExpectedLine(System.Object,System.Object)">
+ <summary>
+ Write the generic 'Expected' line for a given value
+ and tolerance.
+ </summary>
+ <param name="expected">The expected value</param>
+ <param name="tolerance">The tolerance within which the test was made</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteActualLine(NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Write the generic 'Actual' line for a constraint
+ </summary>
+ <param name="constraint">The constraint for which the actual value is to be written</param>
+ </member>
+ <member name="M:NUnit.Framework.TextMessageWriter.WriteActualLine(System.Object)">
+ <summary>
+ Write the generic 'Actual' line for a given value
+ </summary>
+ <param name="actual">The actual value causing a failure</param>
+ </member>
+ <member name="P:NUnit.Framework.TextMessageWriter.MaxLineLength">
+ <summary>
+ Gets the maximum line length for this writer
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.StringAssert">
+ <summary>
+ Basic Asserts on strings.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.Equals(System.Object,System.Object)">
+ <summary>
+ The Equals method throws an AssertionException. This is done
+ to make sure there is no mistake by calling this function.
+ </summary>
+ <param name="a"></param>
+ <param name="b"></param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.ReferenceEquals(System.Object,System.Object)">
+ <summary>
+ override the default ReferenceEquals to throw an AssertionException. This
+ implementation makes sure there is no mistake in calling this function
+ as part of Assert.
+ </summary>
+ <param name="a"></param>
+ <param name="b"></param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.Contains(System.String,System.String,System.String,System.Object[])">
+ <summary>
+ Asserts that a string is found within another string.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The string to be examined</param>
+ <param name="message">The message to display in case of failure</param>
+ <param name="args">Arguments used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.Contains(System.String,System.String,System.String)">
+ <summary>
+ Asserts that a string is found within another string.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The string to be examined</param>
+ <param name="message">The message to display in case of failure</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.Contains(System.String,System.String)">
+ <summary>
+ Asserts that a string is found within another string.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The string to be examined</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.StartsWith(System.String,System.String,System.String,System.Object[])">
+ <summary>
+ Asserts that a string starts with another string.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The string to be examined</param>
+ <param name="message">The message to display in case of failure</param>
+ <param name="args">Arguments used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.StartsWith(System.String,System.String,System.String)">
+ <summary>
+ Asserts that a string starts with another string.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The string to be examined</param>
+ <param name="message">The message to display in case of failure</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.StartsWith(System.String,System.String)">
+ <summary>
+ Asserts that a string starts with another string.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The string to be examined</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.EndsWith(System.String,System.String,System.String,System.Object[])">
+ <summary>
+ Asserts that a string ends with another string.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The string to be examined</param>
+ <param name="message">The message to display in case of failure</param>
+ <param name="args">Arguments used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.EndsWith(System.String,System.String,System.String)">
+ <summary>
+ Asserts that a string ends with another string.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The string to be examined</param>
+ <param name="message">The message to display in case of failure</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.EndsWith(System.String,System.String)">
+ <summary>
+ Asserts that a string ends with another string.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The string to be examined</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.AreEqualIgnoringCase(System.String,System.String,System.String,System.Object[])">
+ <summary>
+ Asserts that two strings are equal, without regard to case.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The actual string</param>
+ <param name="message">The message to display in case of failure</param>
+ <param name="args">Arguments used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.AreEqualIgnoringCase(System.String,System.String,System.String)">
+ <summary>
+ Asserts that two strings are equal, without regard to case.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The actual string</param>
+ <param name="message">The message to display in case of failure</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.AreEqualIgnoringCase(System.String,System.String)">
+ <summary>
+ Asserts that two strings are equal, without regard to case.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The actual string</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.IsMatch(System.String,System.String,System.String,System.Object[])">
+ <summary>
+ Asserts that a string matches an expected regular expression pattern.
+ </summary>
+ <param name="expected">The expected expression</param>
+ <param name="actual">The actual string</param>
+ <param name="message">The message to display in case of failure</param>
+ <param name="args">Arguments used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.IsMatch(System.String,System.String,System.String)">
+ <summary>
+ Asserts that a string matches an expected regular expression pattern.
+ </summary>
+ <param name="expected">The expected expression</param>
+ <param name="actual">The actual string</param>
+ <param name="message">The message to display in case of failure</param>
+ </member>
+ <member name="M:NUnit.Framework.StringAssert.IsMatch(System.String,System.String)">
+ <summary>
+ Asserts that a string matches an expected regular expression pattern.
+ </summary>
+ <param name="expected">The expected expression</param>
+ <param name="actual">The actual string</param>
+ </member>
+ <member name="T:NUnit.Framework.MsgUtils">
+ <summary>
+ Static methods used in creating messages
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.MsgUtils.GetTypeRepresentation(System.Object)">
+ <summary>
+ Returns the representation of a type as used in NUnitLite.
+ This is the same as Type.ToString() except for arrays,
+ which are displayed with their declared sizes.
+ </summary>
+ <param name="obj"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.Framework.MsgUtils.ConvertWhitespace(System.String)">
+ <summary>
+ Converts any control characters in a string
+ to their escaped representation.
+ </summary>
+ <param name="s">The string to be converted</param>
+ <returns>The converted string</returns>
+ </member>
+ <member name="M:NUnit.Framework.MsgUtils.GetArrayIndicesAsString(System.Int32[])">
+ <summary>
+ Return the a string representation for a set of indices into an array
+ </summary>
+ <param name="indices">Array of indices for which a string is needed</param>
+ </member>
+ <member name="M:NUnit.Framework.MsgUtils.GetArrayIndicesFromCollectionIndex(System.Collections.ICollection,System.Int32)">
+ <summary>
+ Get an array of indices representing the point in a collection or
+ array corresponding to a single int index into the collection.
+ </summary>
+ <param name="collection">The collection to which the indices apply</param>
+ <param name="index">Index in the collection</param>
+ <returns>Array of indices</returns>
+ </member>
+ <member name="M:NUnit.Framework.MsgUtils.ClipString(System.String,System.Int32,System.Int32)">
+ <summary>
+ Clip a string around a particular point, returning the clipped
+ string with ellipses representing the removed parts
+ </summary>
+ <param name="s">The string to be clipped</param>
+ <param name="maxStringLength">The maximum permitted length of the result string</param>
+ <param name="mismatch">The point around which clipping is to occur</param>
+ <returns>The clipped string</returns>
+ </member>
+ <member name="M:NUnit.Framework.MsgUtils.FindMismatchPosition(System.String,System.String,System.Int32,System.Boolean)">
+ <summary>
+ Shows the position two strings start to differ. Comparison
+ starts at the start index.
+ </summary>
+ <param name="expected">The expected string</param>
+ <param name="actual">The actual string</param>
+ <param name="istart">The index in the strings at which comparison should start</param>
+ <param name="ignoreCase">Boolean indicating whether case should be ignored</param>
+ <returns>-1 if no mismatch found, or the index where mismatch found</returns>
+ </member>
+ <member name="T:NUnit.Framework.AssertionHelper">
+ <summary>
+ AssertionHelper is an optional base class for user tests,
+ allowing the use of shorter names for constraints and
+ asserts and avoiding conflict with the definition of
+ <see cref="T:NUnit.Framework.SyntaxHelpers.Is"/>, from which it inherits much of its
+ behavior, in certain mock object frameworks.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.AssertionHelper.Expect(System.Object,NUnit.Framework.Constraints.Constraint)">
+ <summary>
+ Apply a constraint to an actual value, succeeding if the constraint
+ is satisfied and throwing an assertion exception on failure. Works
+ identically to <see cref="M:NUnit.Framework.Assert.That(System.Object,NUnit.Framework.Constraints.Constraint)"/>
+ </summary>
+ <param name="constraint">A Constraint to be applied</param>
+ <param name="actual">The actual value to test</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionHelper.Expect(System.Object,NUnit.Framework.Constraints.Constraint,System.String)">
+ <summary>
+ Apply a constraint to an actual value, succeeding if the constraint
+ is satisfied and throwing an assertion exception on failure. Works
+ identically to <see cref="M:NUnit.Framework.Assert.That(System.Object,NUnit.Framework.Constraints.Constraint,System.String)"/>
+ </summary>
+ <param name="constraint">A Constraint to be applied</param>
+ <param name="actual">The actual value to test</param>
+ <param name="message">The message that will be displayed on failure</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionHelper.Expect(System.Object,NUnit.Framework.Constraints.Constraint,System.String,System.Object[])">
+ <summary>
+ Apply a constraint to an actual value, succeeding if the constraint
+ is satisfied and throwing an assertion exception on failure. Works
+ identically to <see cref="M:NUnit.Framework.Assert.That(System.Object,NUnit.Framework.Constraints.Constraint,System.String,System.Object[])"/>
+ </summary>
+ <param name="constraint">A Constraint to be applied</param>
+ <param name="actual">The actual value to test</param>
+ <param name="message">The message that will be displayed on failure</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionHelper.Expect(System.Boolean,System.String,System.Object[])">
+ <summary>
+ Asserts that a condition is true. If the condition is false the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>. Works Identically to
+ <see cref="M:NUnit.Framework.Assert.That(System.Boolean,System.String,System.Object[])"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ <param name="message">The message to display if the condition is false</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionHelper.Expect(System.Boolean,System.String)">
+ <summary>
+ Asserts that a condition is true. If the condition is false the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>. Works Identically to
+ <see cref="M:NUnit.Framework.Assert.That(System.Boolean,System.String)"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ <param name="message">The message to display if the condition is false</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionHelper.Expect(System.Boolean)">
+ <summary>
+ Asserts that a condition is true. If the condition is false the method throws
+ an <see cref="T:NUnit.Framework.AssertionException"/>. Works Identically to <see cref="M:NUnit.Framework.Assert.That(System.Boolean)"/>.
+ </summary>
+ <param name="condition">The evaluated condition</param>
+ </member>
+ <member name="M:NUnit.Framework.AssertionHelper.Map(System.Collections.ICollection)">
+ <summary>
+ Returns a ListMapper based on a collection.
+ </summary>
+ <param name="original">The original collection</param>
+ <returns></returns>
+ </member>
+ <member name="T:NUnit.Framework.FileAssert">
+ <summary>
+ Summary description for FileAssert.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.Equals(System.Object,System.Object)">
+ <summary>
+ The Equals method throws an AssertionException. This is done
+ to make sure there is no mistake by calling this function.
+ </summary>
+ <param name="a"></param>
+ <param name="b"></param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.ReferenceEquals(System.Object,System.Object)">
+ <summary>
+ override the default ReferenceEquals to throw an AssertionException. This
+ implementation makes sure there is no mistake in calling this function
+ as part of Assert.
+ </summary>
+ <param name="a"></param>
+ <param name="b"></param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.#ctor">
+ <summary>
+ We don't actually want any instances of this object, but some people
+ like to inherit from it to add other static methods. Hence, the
+ protected constructor disallows any instances of this object.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreEqual(System.IO.Stream,System.IO.Stream,System.String,System.Object[])">
+ <summary>
+ Verifies that two Streams are equal. Two Streams are considered
+ equal if both are null, or if both have the same value byte for byte.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected Stream</param>
+ <param name="actual">The actual Stream</param>
+ <param name="message">The message to display if Streams are not equal</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreEqual(System.IO.Stream,System.IO.Stream,System.String)">
+ <summary>
+ Verifies that two Streams are equal. Two Streams are considered
+ equal if both are null, or if both have the same value byte for byte.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected Stream</param>
+ <param name="actual">The actual Stream</param>
+ <param name="message">The message to display if objects are not equal</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreEqual(System.IO.Stream,System.IO.Stream)">
+ <summary>
+ Verifies that two Streams are equal. Two Streams are considered
+ equal if both are null, or if both have the same value byte for byte.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected Stream</param>
+ <param name="actual">The actual Stream</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreEqual(System.IO.FileInfo,System.IO.FileInfo,System.String,System.Object[])">
+ <summary>
+ Verifies that two files are equal. Two files are considered
+ equal if both are null, or if both have the same value byte for byte.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">A file containing the value that is expected</param>
+ <param name="actual">A file containing the actual value</param>
+ <param name="message">The message to display if Streams are not equal</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreEqual(System.IO.FileInfo,System.IO.FileInfo,System.String)">
+ <summary>
+ Verifies that two files are equal. Two files are considered
+ equal if both are null, or if both have the same value byte for byte.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">A file containing the value that is expected</param>
+ <param name="actual">A file containing the actual value</param>
+ <param name="message">The message to display if objects are not equal</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreEqual(System.IO.FileInfo,System.IO.FileInfo)">
+ <summary>
+ Verifies that two files are equal. Two files are considered
+ equal if both are null, or if both have the same value byte for byte.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">A file containing the value that is expected</param>
+ <param name="actual">A file containing the actual value</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreEqual(System.String,System.String,System.String,System.Object[])">
+ <summary>
+ Verifies that two files are equal. Two files are considered
+ equal if both are null, or if both have the same value byte for byte.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The path to a file containing the value that is expected</param>
+ <param name="actual">The path to a file containing the actual value</param>
+ <param name="message">The message to display if Streams are not equal</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreEqual(System.String,System.String,System.String)">
+ <summary>
+ Verifies that two files are equal. Two files are considered
+ equal if both are null, or if both have the same value byte for byte.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The path to a file containing the value that is expected</param>
+ <param name="actual">The path to a file containing the actual value</param>
+ <param name="message">The message to display if objects are not equal</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreEqual(System.String,System.String)">
+ <summary>
+ Verifies that two files are equal. Two files are considered
+ equal if both are null, or if both have the same value byte for byte.
+ If they are not equal an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The path to a file containing the value that is expected</param>
+ <param name="actual">The path to a file containing the actual value</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.Stream,System.IO.Stream,System.String,System.Object[])">
+ <summary>
+ Asserts that two Streams are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected Stream</param>
+ <param name="actual">The actual Stream</param>
+ <param name="message">The message to be displayed when the two Stream are the same.</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.Stream,System.IO.Stream,System.String)">
+ <summary>
+ Asserts that two Streams are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected Stream</param>
+ <param name="actual">The actual Stream</param>
+ <param name="message">The message to be displayed when the Streams are the same.</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.Stream,System.IO.Stream)">
+ <summary>
+ Asserts that two Streams are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The expected Stream</param>
+ <param name="actual">The actual Stream</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.FileInfo,System.IO.FileInfo,System.String,System.Object[])">
+ <summary>
+ Asserts that two files are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">A file containing the value that is expected</param>
+ <param name="actual">A file containing the actual value</param>
+ <param name="message">The message to display if Streams are not equal</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.FileInfo,System.IO.FileInfo,System.String)">
+ <summary>
+ Asserts that two files are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">A file containing the value that is expected</param>
+ <param name="actual">A file containing the actual value</param>
+ <param name="message">The message to display if objects are not equal</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreNotEqual(System.IO.FileInfo,System.IO.FileInfo)">
+ <summary>
+ Asserts that two files are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">A file containing the value that is expected</param>
+ <param name="actual">A file containing the actual value</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreNotEqual(System.String,System.String,System.String,System.Object[])">
+ <summary>
+ Asserts that two files are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The path to a file containing the value that is expected</param>
+ <param name="actual">The path to a file containing the actual value</param>
+ <param name="message">The message to display if Streams are not equal</param>
+ <param name="args">Arguments to be used in formatting the message</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreNotEqual(System.String,System.String,System.String)">
+ <summary>
+ Asserts that two files are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The path to a file containing the value that is expected</param>
+ <param name="actual">The path to a file containing the actual value</param>
+ <param name="message">The message to display if objects are not equal</param>
+ </member>
+ <member name="M:NUnit.Framework.FileAssert.AreNotEqual(System.String,System.String)">
+ <summary>
+ Asserts that two files are not equal. If they are equal
+ an <see cref="T:NUnit.Framework.AssertionException"/> is thrown.
+ </summary>
+ <param name="expected">The path to a file containing the value that is expected</param>
+ <param name="actual">The path to a file containing the actual value</param>
+ </member>
+ <member name="T:NUnit.Framework.IgnoreException">
+ <summary>
+ Thrown when an assertion failed.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.IgnoreException.#ctor(System.String)">
+ <param name="message"></param>
+ </member>
+ <member name="M:NUnit.Framework.IgnoreException.#ctor(System.String,System.Exception)">
+ <param name="message">The error message that explains
+ the reason for the exception</param>
+ <param name="inner">The exception that caused the
+ current exception</param>
+ </member>
+ <member name="M:NUnit.Framework.IgnoreException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
+ <summary>
+ Serialization Constructor
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.TestCase">
+ <summary>
+ Obsolete class, formerly used to identify tests through
+ inheritance. Avoid using this class for new tests.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.TestCase.SetUp">
+ <summary>
+ Method called immediately before running the test.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.TestCase.TearDown">
+ <summary>
+ Method Called immediately after running the test. It is
+ guaranteed to be called, even if an exception is thrown.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.SetUpAttribute">
+ <summary>
+ Attribute used to mark a class that contains one-time SetUp
+ and/or TearDown methods that apply to all the tests in a
+ namespace or an assembly.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.SetUpFixtureAttribute">
+ <summary>
+ SetUpFixtureAttribute is used to identify a SetUpFixture
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.SuiteAttribute">
+ <summary>
+ Attribute used to mark a static (shared in VB) property
+ that returns a list of tests.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.TearDownAttribute">
+ <summary>
+ Attribute used to identify a method that is called
+ immediately after each test is run. The method is
+ guaranteed to be called, even if an exception is thrown.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.TestAttribute">
+ <summary>
+ Adding this attribute to a method within a <seealso cref="T:NUnit.Framework.TestFixtureAttribute"/>
+ class makes the method callable from the NUnit test runner. There is a property
+ called Description which is optional which you can provide a more detailed test
+ description. This class cannot be inherited.
+ </summary>
+
+ <example>
+ [TestFixture]
+ public class Fixture
+ {
+ [Test]
+ public void MethodToTest()
+ {}
+
+ [Test(Description = "more detailed description")]
+ publc void TestDescriptionMethod()
+ {}
+ }
+ </example>
+
+ </member>
+ <member name="P:NUnit.Framework.TestAttribute.Description">
+ <summary>
+ Descriptive text for this test
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.TestFixtureAttribute">
+ <example>
+ [TestFixture]
+ public class ExampleClass
+ {}
+ </example>
+ </member>
+ <member name="P:NUnit.Framework.TestFixtureAttribute.Description">
+ <summary>
+ Descriptive text for this fixture
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.TestFixtureSetUpAttribute">
+ <summary>
+ Attribute used to identify a method that is
+ called before any tests in a fixture are run.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.TestFixtureTearDownAttribute">
+ <summary>
+ Attribute used to identify a method that is called after
+ all the tests in a fixture have run. The method is
+ guaranteed to be called, even if an exception is thrown.
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.IgnoreAttribute">
+ <summary>
+ Attribute used to mark a test that is to be ignored.
+ Ignored tests result in a warning message when the
+ tests are run.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.IgnoreAttribute.#ctor">
+ <summary>
+ Constructs the attribute without giving a reason
+ for ignoring the test.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.IgnoreAttribute.#ctor(System.String)">
+ <summary>
+ Constructs the attribute giving a reason for ignoring the test
+ </summary>
+ <param name="reason">The reason for ignoring the test</param>
+ </member>
+ <member name="P:NUnit.Framework.IgnoreAttribute.Reason">
+ <summary>
+ The reason for ignoring a test
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.ExplicitAttribute">
+ <summary>
+ ExplicitAttribute marks a test or test fixture so that it will
+ only be run if explicitly executed from the gui or command line
+ or if it is included by use of a filter. The test will not be
+ run simply because an enclosing suite is run.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.ExplicitAttribute.#ctor">
+ <summary>
+ Default constructor
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.ExplicitAttribute.#ctor(System.String)">
+ <summary>
+ Constructor with a reason
+ </summary>
+ <param name="reason">The reason test is marked explicit</param>
+ </member>
+ <member name="P:NUnit.Framework.ExplicitAttribute.Reason">
+ <summary>
+ The reason test is marked explicit
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.DescriptionAttribute">
+ <summary>
+ Attribute used to provide descriptive text about a
+ test case or fixture.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.DescriptionAttribute.#ctor(System.String)">
+ <summary>
+ Construct the attribute
+ </summary>
+ <param name="description">Text describing the test</param>
+ </member>
+ <member name="P:NUnit.Framework.DescriptionAttribute.Description">
+ <summary>
+ Gets the test description
+ </summary>
+ </member>
+ <member name="T:NUnit.Framework.IExpectException">
+ <summary>
+ Interface implemented by a user fixture in order to
+ validate any expected exceptions. It is only called
+ for test methods marked with the ExpectedException
+ attribute.
+ </summary>
+ </member>
+ <member name="M:NUnit.Framework.IExpectException.HandleException(System.Exception)">
+ <summary>
+ Method to handle an expected exception
+ </summary>
+ <param name="ex">The exception to be handled</param>
+ </member>
+ </members>
+</doc>
diff --git a/Src/Newtonsoft.Json.Tests/AspNetAjaxDateTimeConverterTest.cs b/Src/Newtonsoft.Json.Tests/AspNetAjaxDateTimeConverterTest.cs new file mode 100644 index 0000000..f76ded5 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/AspNetAjaxDateTimeConverterTest.cs @@ -0,0 +1,70 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using Newtonsoft.Json;
+using System.IO;
+using Newtonsoft.Json.Converters;
+
+namespace Newtonsoft.Json.Tests
+{
+ [TestFixture]
+ public class AspNetAjaxDateTimeConverterTest
+ {
+ public class DateTimeTestClass
+ {
+ public string PreField;
+ public DateTime DateTimeField;
+ public string PostField;
+ }
+
+ [Test]
+ public void Serialize()
+ {
+ DateTimeTestClass c = new DateTimeTestClass();
+ c.DateTimeField = new DateTime(2008, 12, 12, 12, 12, 12, 12);
+ c.PreField = "Pre";
+ c.PostField = "Post";
+
+ string json = JavaScriptConvert.SerializeObject(c, new AspNetAjaxDateTimeConverter());
+
+ Assert.AreEqual(@"{""PreField"":""Pre"",""DateTimeField"":""@1229083932012@"",""PostField"":""Post""}", json);
+ }
+
+ [Test]
+ public void DeSerialize()
+ {
+ DateTimeTestClass c =
+ JavaScriptConvert.DeserializeObject<DateTimeTestClass>(@"{""PreField"":""Pre"",""DateTimeField"":""@1229083932012@"",""PostField"":""Post""}", new AspNetAjaxDateTimeConverter());
+
+ Assert.AreEqual(new DateTime(2008, 12, 12, 12, 12, 12, 12), c.DateTimeField);
+ Assert.AreEqual("Pre", c.PreField);
+ Assert.AreEqual("Post", c.PostField);
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/JsonReaderTest.cs b/Src/Newtonsoft.Json.Tests/JsonReaderTest.cs new file mode 100644 index 0000000..5bb32aa --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/JsonReaderTest.cs @@ -0,0 +1,220 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using Newtonsoft.Json;
+using System.IO;
+
+namespace Newtonsoft.Json.Tests
+{
+ [TestFixture]
+ public class JsonReaderTest
+ {
+ [Test]
+ public void YahooFinance()
+ {
+ string input = @"{
+""matches"" : [
+{""t"":""C"", ""n"":""Citigroup Inc."", ""e"":""NYSE"", ""id"":""662713""}
+,{""t"":""CHL"", ""n"":""China Mobile Ltd. (ADR)"", ""e"":""NYSE"", ""id"":""660998""}
+,{""t"":""PTR"", ""n"":""PetroChina Company Limited (ADR)"", ""e"":""NYSE"", ""id"":""664536""}
+,{""t"":""RIO"", ""n"":""Companhia Vale do Rio Doce (ADR)"", ""e"":""NYSE"", ""id"":""671472""}
+,{""t"":""RIOPR"", ""n"":""Companhia Vale do Rio Doce (ADR)"", ""e"":""NYSE"", ""id"":""3512643""}
+,{""t"":""CSCO"", ""n"":""Cisco Systems, Inc."", ""e"":""NASDAQ"", ""id"":""99624""}
+,{""t"":""CVX"", ""n"":""Chevron Corporation"", ""e"":""NYSE"", ""id"":""667226""}
+,{""t"":""TM"", ""n"":""Toyota Motor Corporation (ADR)"", ""e"":""NYSE"", ""id"":""655880""}
+,{""t"":""JPM"", ""n"":""JPMorgan Chase \x26 Co."", ""e"":""NYSE"", ""id"":""665639""}
+,{""t"":""COP"", ""n"":""ConocoPhillips"", ""e"":""NYSE"", ""id"":""1691168""}
+,{""t"":""LFC"", ""n"":""China Life Insurance Company Ltd. (ADR)"", ""e"":""NYSE"", ""id"":""688679""}
+,{""t"":""NOK"", ""n"":""Nokia Corporation (ADR)"", ""e"":""NYSE"", ""id"":""657729""}
+,{""t"":""KO"", ""n"":""The Coca-Cola Company"", ""e"":""NYSE"", ""id"":""6550""}
+,{""t"":""VZ"", ""n"":""Verizon Communications Inc."", ""e"":""NYSE"", ""id"":""664887""}
+,{""t"":""AMX"", ""n"":""America Movil S.A.B de C.V. (ADR)"", ""e"":""NYSE"", ""id"":""665834""}],
+""all"" : false
+}
+";
+
+ using (JsonReader jsonReader = new JsonReader(new StringReader(input)))
+ {
+ while (jsonReader.Read())
+ {
+ Console.WriteLine(jsonReader.Value);
+ }
+ }
+ }
+
+ [Test]
+ public void ReadingIndented()
+ {
+ string input = @"{
+ CPU: 'Intel',
+ Drives: [
+ 'DVD read/writer',
+ ""500 gigabyte hard drive""
+ ]
+}";
+
+ StringReader sr = new StringReader(input);
+
+ using (JsonReader jsonReader = new JsonReader(sr))
+ {
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.None);
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.StartObject);
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.PropertyName);
+ Assert.AreEqual(jsonReader.Value, "CPU");
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.String);
+ Assert.AreEqual(jsonReader.Value, "Intel");
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.PropertyName);
+ Assert.AreEqual(jsonReader.Value, "Drives");
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.StartArray);
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.String);
+ Assert.AreEqual(jsonReader.Value, "DVD read/writer");
+ Assert.AreEqual(jsonReader.QuoteChar, '\'');
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.String);
+ Assert.AreEqual(jsonReader.Value, "500 gigabyte hard drive");
+ Assert.AreEqual(jsonReader.QuoteChar, '"');
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.EndArray);
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.EndObject);
+ }
+ }
+
+ [Test]
+ public void ReadingEscapedStrings()
+ {
+ string input = "{value:'Purple\\r \\n monkey\\'s:\\tdishwasher'}";
+
+ StringReader sr = new StringReader(input);
+
+ using (JsonReader jsonReader = new JsonReader(sr))
+ {
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.StartObject);
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.PropertyName);
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.String);
+ Assert.AreEqual(jsonReader.Value, "Purple\r \n monkey's:\tdishwasher");
+ Assert.AreEqual(jsonReader.QuoteChar, '\'');
+
+ jsonReader.Read();
+ Assert.AreEqual(jsonReader.TokenType, JsonToken.EndObject);
+ }
+ }
+
+ [Test]
+ public void ReadNewlineLastCharacter()
+ {
+ string input = @"{
+ CPU: 'Intel',
+ Drives: [
+ 'DVD read/writer',
+ ""500 gigabyte hard drive""
+ ]
+}" + '\n';
+
+ object o = JavaScriptConvert.DeserializeObject(input);
+ }
+
+ [Test]
+ public void WriteReadWrite()
+ {
+ StringBuilder sb = new StringBuilder();
+ StringWriter sw = new StringWriter(sb);
+
+ using (JsonWriter jsonWriter = new JsonWriter(sw))
+ {
+ jsonWriter.WriteStartArray();
+ jsonWriter.WriteValue(true);
+
+ jsonWriter.WriteStartObject();
+ jsonWriter.WritePropertyName("integer");
+ jsonWriter.WriteValue(99);
+ jsonWriter.WritePropertyName("string");
+ jsonWriter.WriteValue("how now brown cow?");
+ jsonWriter.WritePropertyName("array");
+
+ jsonWriter.WriteStartArray();
+ for (int i = 0; i < 5; i++)
+ {
+ jsonWriter.WriteValue(i);
+ }
+
+ jsonWriter.WriteStartObject();
+ jsonWriter.WritePropertyName("decimal");
+ jsonWriter.WriteValue(990.00990099m);
+ jsonWriter.WriteEndObject();
+
+ jsonWriter.WriteValue(5);
+ jsonWriter.WriteEndArray();
+
+ jsonWriter.WriteEndObject();
+
+ jsonWriter.WriteValue("This is a string.");
+ jsonWriter.WriteNull();
+ jsonWriter.WriteNull();
+ jsonWriter.WriteEndArray();
+ }
+
+ string json = sb.ToString();
+
+ JsonSerializer serializer = new JsonSerializer();
+
+ object jsonObject = serializer.Deserialize(new JsonReader(new StringReader(json)));
+
+ sb = new StringBuilder();
+ sw = new StringWriter(sb);
+
+ using (JsonWriter jsonWriter = new JsonWriter(sw))
+ {
+ serializer.Serialize(sw, jsonObject);
+ }
+
+ Assert.AreEqual(json, sb.ToString());
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/JsonSerializerTest.cs b/Src/Newtonsoft.Json.Tests/JsonSerializerTest.cs new file mode 100644 index 0000000..fbbd1ce --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/JsonSerializerTest.cs @@ -0,0 +1,529 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using Newtonsoft.Json;
+using System.IO;
+using System.Collections;
+using System.Xml;
+using System.Xml.Serialization;
+using System.Collections.ObjectModel;
+
+namespace Newtonsoft.Json.Tests
+{
+ public class Product
+ {
+ public string Name;
+ public DateTime Expiry;
+ public decimal Price;
+ public string[] Sizes;
+ }
+
+ public class Store
+ {
+ public StoreColor Color = StoreColor.Yellow;
+ public DateTime Establised = new DateTime(2010, 1, 22);
+ public double Width = 1.1;
+ public int Employees = 999;
+ public int[] RoomsPerFloor = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ public bool Open = false;
+ public char Symbol = '@';
+ public List<string> Mottos = new List<string>();
+ public decimal Cost = 100980.1M;
+ public string Escape = "\r\n\t\f\b?{\\r\\n\"\'";
+ public List<Product> product = new List<Product>();
+
+ public Store()
+ {
+ Mottos.Add("Hello World");
+ Mottos.Add("öäüÖÄÜ\\'{new Date(12345);}[222]_µ@²³~");
+ Mottos.Add(null);
+ Mottos.Add(" ");
+
+ Product rocket = new Product();
+ rocket.Name = "Rocket";
+ rocket.Expiry = new DateTime(2000, 2, 2, 23, 1, 30);
+ Product alien = new Product();
+ alien.Name = "Alien";
+
+ product.Add(rocket);
+ product.Add(alien);
+ }
+ }
+
+ public enum StoreColor
+ {
+ Black,
+ Red,
+ Yellow,
+ White
+ }
+
+ [TestFixture]
+ public class JsonSerializerTest
+ {
+ [Test]
+ public void PersonTypedObjectDeserialization()
+ {
+ Store store = new Store();
+
+ string jsonText = JavaScriptConvert.SerializeObject(store);
+
+ Store deserializedStore = (Store)JavaScriptConvert.DeserializeObject(jsonText, typeof(Store));
+
+ Console.WriteLine(jsonText);
+ }
+
+ [Test]
+ public void TypedObjectDeserialization()
+ {
+ Product product = new Product();
+
+ product.Name = "Apple";
+ product.Expiry = new DateTime(2008, 12, 28);
+ product.Price = 3.99M;
+ product.Sizes = new string[] { "Small", "Medium", "Large" };
+
+ string output = JavaScriptConvert.SerializeObject(product);
+ //{
+ // "Name": "Apple",
+ // "Expiry": new Date(1230422400000),
+ // "Price": 3.99,
+ // "Sizes": [
+ // "Small",
+ // "Medium",
+ // "Large"
+ // ]
+ //}
+
+ Product deserializedProduct = (Product)JavaScriptConvert.DeserializeObject(output, typeof(Product));
+
+ Assert.AreEqual("Apple", deserializedProduct.Name);
+ Assert.AreEqual(new DateTime(2008, 12, 28), deserializedProduct.Expiry);
+ Assert.AreEqual(3.99, deserializedProduct.Price);
+ Assert.AreEqual("Small", deserializedProduct.Sizes[0]);
+ Assert.AreEqual("Medium", deserializedProduct.Sizes[1]);
+ Assert.AreEqual("Large", deserializedProduct.Sizes[2]);
+ }
+
+ [Test]
+ public void JavaScriptConvertSerializer()
+ {
+ string value = @"{""Name"":""Orange"", ""Price"":3.99, ""Expiry"":""01/24/2010 12:00:00""}";
+
+ Product p = JavaScriptConvert.DeserializeObject(value, typeof(Product)) as Product;
+
+ Assert.AreEqual("Orange", p.Name);
+ Assert.AreEqual(new DateTime(2010, 1, 24, 12, 0, 0), p.Expiry);
+ Assert.AreEqual(3.99, p.Price);
+ }
+
+ [Test]
+ public void DeserializeJavaScriptDate()
+ {
+ DateTime dateValue = new DateTime(2000, 3, 30);
+ Dictionary<string, object> testDictionary = new Dictionary<string, object>();
+ testDictionary["date"] = dateValue;
+
+ string jsonText = JavaScriptConvert.SerializeObject(testDictionary);
+
+ Dictionary<string, object> deserializedDictionary = (Dictionary<string, object>)JavaScriptConvert.DeserializeObject(jsonText, typeof(Dictionary<string, object>));
+ DateTime deserializedDate = (DateTime)deserializedDictionary["date"];
+
+ Assert.AreEqual(dateValue, deserializedDate);
+
+ Console.WriteLine("DeserializeJavaScriptDate");
+ Console.WriteLine(jsonText);
+ Console.WriteLine();
+ Console.WriteLine(jsonText);
+ }
+
+ public class MethodExecutorObject
+ {
+ public string serverClassName;
+ public object[] serverMethodParams;
+ public string clientGetResultFunction;
+ }
+
+ [Test]
+ public void TestMethodExecutorObject()
+ {
+ MethodExecutorObject executorObject = new MethodExecutorObject();
+ executorObject.serverClassName = "BanSubs";
+ executorObject.serverMethodParams = new object[] { "21321546", "101", "1236", "D:\\1.txt" };
+ executorObject.clientGetResultFunction = "ClientBanSubsCB";
+
+ string output = JavaScriptConvert.SerializeObject(executorObject);
+
+ MethodExecutorObject executorObject2 = JavaScriptConvert.DeserializeObject(output, typeof(MethodExecutorObject)) as MethodExecutorObject;
+
+ Assert.AreNotSame(executorObject, executorObject2);
+ Assert.AreEqual(executorObject2.serverClassName, "BanSubs");
+ Assert.AreEqual(executorObject2.serverMethodParams.Length, 4);
+ Assert.Contains("101", executorObject2.serverMethodParams);
+ Assert.AreEqual(executorObject2.clientGetResultFunction, "ClientBanSubsCB");
+ }
+
+ [Test]
+ public void HashtableDeserialization()
+ {
+ string value = @"{""Name"":""Orange"", ""Price"":3.99, ""Expiry"":""01/24/2010 12:00:00""}";
+
+ Hashtable p = JavaScriptConvert.DeserializeObject(value, typeof(Hashtable)) as Hashtable;
+
+ Assert.AreEqual("Orange", p["Name"].ToString());
+ }
+
+ public class TypedSubHashtable
+ {
+ public string Name;
+ public Hashtable Hash;
+ }
+
+ [Test]
+ public void TypedHashtableDeserialization()
+ {
+ string value = @"{""Name"":""Orange"", ""Hash"":{""Expiry"":""01/24/2010 12:00:00""}}";
+
+ TypedSubHashtable p = JavaScriptConvert.DeserializeObject(value, typeof(TypedSubHashtable)) as TypedSubHashtable;
+
+ Assert.AreEqual("01/24/2010 12:00:00", p.Hash["Expiry"].ToString());
+ }
+
+ public class GetOnlyPropertyClass
+ {
+ public string Field = "Field";
+
+ public string GetOnlyProperty
+ {
+ get { return "GetOnlyProperty"; }
+ }
+ }
+
+ [Test]
+ public void SerializeDeserializeGetOnlyProperty()
+ {
+ string value = JavaScriptConvert.SerializeObject(new GetOnlyPropertyClass());
+
+ GetOnlyPropertyClass c = JavaScriptConvert.DeserializeObject<GetOnlyPropertyClass>(value);
+
+ Assert.AreEqual(c.Field, "Field");
+ Assert.AreEqual(c.GetOnlyProperty, "GetOnlyProperty");
+ }
+
+ public class SetOnlyPropertyClass
+ {
+ public string Field = "Field";
+
+ public string SetOnlyProperty
+ {
+ set { }
+ }
+ }
+
+ [Test]
+ public void SerializeDeserializeSetOnlyProperty()
+ {
+ string value = JavaScriptConvert.SerializeObject(new SetOnlyPropertyClass());
+
+ SetOnlyPropertyClass c = JavaScriptConvert.DeserializeObject<SetOnlyPropertyClass>(value);
+
+ Assert.AreEqual(c.Field, "Field");
+ }
+
+ public class JsonIgnoreAttributeTestClass
+ {
+ private int _property = 21;
+ private int _ignoredProperty = 12;
+
+ public int Field;
+ public int Property
+ {
+ get { return _property; }
+ }
+
+ [JsonIgnore]
+ public int IgnoredField;
+
+ [JsonIgnore]
+ public int IgnoredProperty
+ {
+ get { return _ignoredProperty; }
+ }
+ }
+
+ [Test]
+ public void JsonIgnoreAttributeTest()
+ {
+ string json = JavaScriptConvert.SerializeObject(new JsonIgnoreAttributeTestClass());
+
+ Assert.AreEqual(@"{""Field"":0,""Property"":21}", json);
+
+ JsonIgnoreAttributeTestClass c = JavaScriptConvert.DeserializeObject<JsonIgnoreAttributeTestClass>(@"{""Field"":99,""Property"":-1,""IgnoredField"":-1}");
+
+ Assert.AreEqual(0, c.IgnoredField);
+ Assert.AreEqual(99, c.Field);
+ }
+
+ [Test]
+ public void GoogleSearchAPI()
+ {
+ string json = @"{
+ results:
+ [
+ {
+ GsearchResultClass:""GwebSearch"",
+ unescapedUrl : ""http://www.google.com/"",
+ url : ""http://www.google.com/"",
+ visibleUrl : ""www.google.com"",
+ cacheUrl :
+""http://www.google.com/search?q=cache:zhool8dxBV4J:www.google.com"",
+ title : ""Google"",
+ titleNoFormatting : ""Google"",
+ content : ""Enables users to search the Web, Usenet, and
+images. Features include PageRank, caching and translation of
+results, and an option to find similar pages.""
+ },
+ {
+ GsearchResultClass:""GwebSearch"",
+ unescapedUrl : ""http://news.google.com/"",
+ url : ""http://news.google.com/"",
+ visibleUrl : ""news.google.com"",
+ cacheUrl :
+""http://www.google.com/search?q=cache:Va_XShOz_twJ:news.google.com"",
+ title : ""Google News"",
+ titleNoFormatting : ""Google News"",
+ content : ""Aggregated headlines and a search engine of many of the world's news sources.""
+ },
+
+ {
+ GsearchResultClass:""GwebSearch"",
+ unescapedUrl : ""http://groups.google.com/"",
+ url : ""http://groups.google.com/"",
+ visibleUrl : ""groups.google.com"",
+ cacheUrl :
+""http://www.google.com/search?q=cache:x2uPD3hfkn0J:groups.google.com"",
+ title : ""Google Groups"",
+ titleNoFormatting : ""Google Groups"",
+ content : ""Enables users to search and browse the Usenet
+archives which consist of over 700 million messages, and post new
+comments.""
+ },
+
+ {
+ GsearchResultClass:""GwebSearch"",
+ unescapedUrl : ""http://maps.google.com/"",
+ url : ""http://maps.google.com/"",
+ visibleUrl : ""maps.google.com"",
+ cacheUrl :
+""http://www.google.com/search?q=cache:dkf5u2twBXIJ:maps.google.com"",
+ title : ""Google Maps"",
+ titleNoFormatting : ""Google Maps"",
+ content : ""Provides directions, interactive maps, and
+satellite/aerial imagery of the United States. Can also search by
+keyword such as type of business.""
+ }
+ ],
+
+ adResults:
+ [
+ {
+ GsearchResultClass:""GwebSearch.ad"",
+ title : ""Gartner Symposium/ITxpo"",
+ content1 : ""Meet brilliant Gartner IT analysts"",
+ content2 : ""20-23 May 2007- Barcelona, Spain"",
+ url :
+""http://www.google.com/url?sa=L&ai=BVualExYGRo3hD5ianAPJvejjD8-s6ye7kdTwArbI4gTAlrECEAEYASDXtMMFOAFQubWAjvr_____AWDXw_4EiAEBmAEAyAEBgAIB&num=1&q=http://www.gartner.com/it/sym/2007/spr8/spr8.jsp%3Fsrc%3D_spain_07_%26WT.srch%3D1&usg=__CxRH06E4Xvm9Muq13S4MgMtnziY="",
+
+ impressionUrl :
+""http://www.google.com/uds/css/ad-indicator-on.gif?ai=BVualExYGRo3hD5ianAPJvejjD8-s6ye7kdTwArbI4gTAlrECEAEYASDXtMMFOAFQubWAjvr_____AWDXw_4EiAEBmAEAyAEBgAIB"",
+
+ unescapedUrl :
+""http://www.google.com/url?sa=L&ai=BVualExYGRo3hD5ianAPJvejjD8-s6ye7kdTwArbI4gTAlrECEAEYASDXtMMFOAFQubWAjvr_____AWDXw_4EiAEBmAEAyAEBgAIB&num=1&q=http://www.gartner.com/it/sym/2007/spr8/spr8.jsp%3Fsrc%3D_spain_07_%26WT.srch%3D1&usg=__CxRH06E4Xvm9Muq13S4MgMtnziY="",
+
+ visibleUrl : ""www.gartner.com""
+ }
+ ]
+}
+";
+ object o = JavaScriptConvert.DeserializeObject(json);
+ string s = string.Empty;
+ s += s;
+ }
+
+ [Test]
+ public void TorrentDeserializeTest()
+ {
+ string jsonText = @"{
+"""":"""",
+""label"": [
+ [""SomeName"",6]
+],
+""torrents"": [
+ [""192D99A5C943555CB7F00A852821CF6D6DB3008A"",201,""filename.avi"",178311826,1000,178311826,72815250,408,1603,7,121430,""NameOfLabelPrevioslyDefined"",3,6,0,8,128954,-1,0],
+],
+""torrentc"": ""1816000723""
+}";
+
+ JavaScriptObject o = (JavaScriptObject)JavaScriptConvert.DeserializeObject(jsonText);
+ Assert.AreEqual(4, o.Count);
+
+ JavaScriptArray torrentsArray = (JavaScriptArray)o["torrents"];
+ JavaScriptArray nestedTorrentsArray = (JavaScriptArray)torrentsArray[0];
+ Assert.AreEqual(nestedTorrentsArray.Count, 19);
+ }
+
+ public class JsonPropertyClass
+ {
+ [JsonProperty("pie")]
+ public string Pie = "Yum";
+
+ [JsonIgnore]
+ public string pie = "No pie for you!";
+
+ public string pie1 = "PieChart!";
+
+ private int _sweetCakesCount;
+
+ [JsonProperty("sweet_cakes_count")]
+ public int SweetCakesCount
+ {
+ get { return _sweetCakesCount; }
+ set { _sweetCakesCount = value; }
+ }
+ }
+
+ [Test]
+ public void JsonPropertyClassSerialize()
+ {
+ JsonPropertyClass test = new JsonPropertyClass();
+ test.Pie = "Delicious";
+ test.SweetCakesCount = int.MaxValue;
+
+ string jsonText = JavaScriptConvert.SerializeObject(test);
+
+ Assert.AreEqual(@"{""pie"":""Delicious"",""pie1"":""PieChart!"",""sweet_cakes_count"":2147483647}", jsonText);
+
+ JsonPropertyClass test2 = JavaScriptConvert.DeserializeObject<JsonPropertyClass>(jsonText);
+
+ Assert.AreEqual(test.Pie, test2.Pie);
+ Assert.AreEqual(test.SweetCakesCount, test2.SweetCakesCount);
+ }
+
+ public class BadJsonPropertyClass
+ {
+ [JsonProperty("pie")]
+ public string Pie = "Yum";
+
+ public string pie = "PieChart!";
+ }
+
+ [Test]
+ [ExpectedException(typeof(JsonSerializationException), ExpectedMessage = @"A member with the name 'pie' already exists on Newtonsoft.Json.Tests.JsonSerializerTest+BadJsonPropertyClass. Use the JsonPropertyAttribute to specify another name.")]
+ public void BadJsonPropertyClassSerialize()
+ {
+ JavaScriptConvert.SerializeObject(new BadJsonPropertyClass());
+ }
+
+ public class Article
+ {
+ public string Name;
+
+ public Article()
+ {
+ }
+
+ public Article(string name)
+ {
+ Name = name;
+ }
+ }
+
+ public class ArticleCollection : List<Article>
+ {
+ }
+
+ [Test]
+ public void InheritedListSerialize()
+ {
+ Article a1 = new Article("a1");
+ Article a2 = new Article("a2");
+
+ ArticleCollection articles1 = new ArticleCollection();
+ articles1.Add(a1);
+ articles1.Add(a2);
+
+ string jsonText = JavaScriptConvert.SerializeObject(articles1);
+
+ ArticleCollection articles2 = JavaScriptConvert.DeserializeObject<ArticleCollection>(jsonText);
+
+ Assert.AreEqual(articles1.Count, articles2.Count);
+ Assert.AreEqual(articles1[0].Name, articles2[0].Name);
+ }
+
+ [Test]
+ public void ReadOnlyCollectionSerialize()
+ {
+ ReadOnlyCollection<int> r1 = new ReadOnlyCollection<int>(new int[] {0, 1, 2, 3, 4});
+
+ string jsonText = JavaScriptConvert.SerializeObject(r1);
+
+ ReadOnlyCollection<int> r2 = JavaScriptConvert.DeserializeObject<ReadOnlyCollection<int>>(jsonText);
+
+ CollectionAssert.AreEqual(r1, r2);
+ }
+
+ //public abstract class Foo
+ //{
+ //}
+
+ //public class Baz : Foo
+ //{
+ //}
+
+ //public class Bar : Foo
+ //{
+ //}
+
+ //public class BazJsonConverter : JsonConverter
+ //{
+ // public override bool CanConvert(Type objectType)
+ // {
+ // throw new Exception("The method or operation is not implemented.");
+ // }
+ //}
+
+ //public class BarJsonConverter : JsonConverter
+ //{
+ // public override bool CanConvert(Type objectType)
+ // {
+ // throw new Exception("The method or operation is not implemented.");
+ // }
+ //}
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/JsonWriterTest.cs b/Src/Newtonsoft.Json.Tests/JsonWriterTest.cs new file mode 100644 index 0000000..5bb8aeb --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/JsonWriterTest.cs @@ -0,0 +1,176 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using Newtonsoft.Json;
+using System.IO;
+
+namespace Newtonsoft.Json.Tests
+{
+ [TestFixture]
+ public class JsonWriterTest
+ {
+ [Test]
+ public void ValueFormatting()
+ {
+ StringBuilder sb = new StringBuilder();
+ StringWriter sw = new StringWriter(sb);
+
+ using (JsonWriter jsonWriter = new JsonWriter(sw))
+ {
+ jsonWriter.WriteStartArray();
+ jsonWriter.WriteValue('@');
+ jsonWriter.WriteValue("\r\n\t\f\b?{\\r\\n\"\'");
+ jsonWriter.WriteValue(true);
+ jsonWriter.WriteValue(10);
+ jsonWriter.WriteValue(10.99);
+ jsonWriter.WriteValue(0.99);
+ jsonWriter.WriteValue(0.000000000000000001d);
+ jsonWriter.WriteValue(0.000000000000000001m);
+ jsonWriter.WriteValue(null);
+ jsonWriter.WriteValue("This is a string.");
+ jsonWriter.WriteNull();
+ jsonWriter.WriteUndefined();
+ jsonWriter.WriteEndArray();
+ }
+
+ string expected = @"[""@"",""\r\n\t\f\b?{\\r\\n\""'"",true,10,10.99,0.99,1E-18,0.000000000000000001,"""",""This is a string."",null,undefined]";
+ string result = sb.ToString();
+
+ Console.WriteLine("ValueFormatting");
+ Console.WriteLine(result);
+
+ Assert.AreEqual(expected, result);
+ }
+
+ [Test]
+ public void StringEscaping()
+ {
+ StringBuilder sb = new StringBuilder();
+ StringWriter sw = new StringWriter(sb);
+
+ using (JsonWriter jsonWriter = new JsonWriter(sw))
+ {
+ jsonWriter.WriteStartArray();
+ jsonWriter.WriteValue(@"""These pretzels are making me thirsty!""");
+ jsonWriter.WriteValue("Jeff's house was burninated.");
+ jsonWriter.WriteValue(@"1. You don't talk about fight club.
+2. You don't talk about fight club.");
+ jsonWriter.WriteValue("35% of\t statistics\n are made\r up.");
+ jsonWriter.WriteEndArray();
+ }
+
+ string expected = @"[""\""These pretzels are making me thirsty!\"""",""Jeff's house was burninated."",""1. You don't talk about fight club.\r\n2. You don't talk about fight club."",""35% of\t statistics\n are made\r up.""]";
+ string result = sb.ToString();
+
+ Console.WriteLine("StringEscaping");
+ Console.WriteLine(result);
+
+ Assert.AreEqual(expected, result);
+ }
+
+ [Test]
+ public void Indenting()
+ {
+ StringBuilder sb = new StringBuilder();
+ StringWriter sw = new StringWriter(sb);
+
+ using (JsonWriter jsonWriter = new JsonWriter(sw))
+ {
+ jsonWriter.Formatting = Formatting.Indented;
+
+ jsonWriter.WriteStartObject();
+ jsonWriter.WritePropertyName("CPU");
+ jsonWriter.WriteValue("Intel");
+ jsonWriter.WritePropertyName("PSU");
+ jsonWriter.WriteValue("500W");
+ jsonWriter.WritePropertyName("Drives");
+ jsonWriter.WriteStartArray();
+ jsonWriter.WriteValue("DVD read/writer");
+ jsonWriter.WriteComment("(broken)");
+ jsonWriter.WriteValue("500 gigabyte hard drive");
+ jsonWriter.WriteValue("200 gigabype hard drive");
+ jsonWriter.WriteEnd();
+ jsonWriter.WriteEndObject();
+ }
+
+ string expected = @"{
+ ""CPU"": ""Intel"",
+ ""PSU"": ""500W"",
+ ""Drives"": [
+ ""DVD read/writer""
+ /*(broken)*/,
+ ""500 gigabyte hard drive"",
+ ""200 gigabype hard drive""
+ ]
+}";
+ string result = sb.ToString();
+
+ Console.WriteLine("Indenting");
+ Console.WriteLine(result);
+
+ Assert.AreEqual(expected, result);
+ }
+
+ [Test]
+ public void State()
+ {
+ StringBuilder sb = new StringBuilder();
+ StringWriter sw = new StringWriter(sb);
+
+ using (JsonWriter jsonWriter = new JsonWriter(sw))
+ {
+ Assert.AreEqual(WriteState.Start, jsonWriter.WriteState);
+
+ jsonWriter.WriteStartObject();
+ Assert.AreEqual(WriteState.Object, jsonWriter.WriteState);
+
+ jsonWriter.WritePropertyName("CPU");
+ Assert.AreEqual(WriteState.Property, jsonWriter.WriteState);
+
+ jsonWriter.WriteValue("Intel");
+ Assert.AreEqual(WriteState.Object, jsonWriter.WriteState);
+
+ jsonWriter.WritePropertyName("Drives");
+ Assert.AreEqual(WriteState.Property, jsonWriter.WriteState);
+
+ jsonWriter.WriteStartArray();
+ Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
+
+ jsonWriter.WriteValue("DVD read/writer");
+ Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
+
+ jsonWriter.WriteEnd();
+ Assert.AreEqual(WriteState.Object, jsonWriter.WriteState);
+
+ jsonWriter.WriteEndObject();
+ Assert.AreEqual(WriteState.Start, jsonWriter.WriteState);
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj new file mode 100644 index 0000000..a1bb2c4 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj @@ -0,0 +1,69 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{3E6E2335-B079-4B5B-A65A-9D586914BCBB}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Newtonsoft.Json.Tests</RootNamespace>
+ <AssemblyName>Newtonsoft.Json.Tests</AssemblyName>
+ <SccProjectName>
+ </SccProjectName>
+ <SccLocalPath>
+ </SccLocalPath>
+ <SccAuxPath>
+ </SccAuxPath>
+ <SccProvider>
+ </SccProvider>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="nunit.framework, Version=2.4.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\Lib\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AspNetAjaxDateTimeConverterTest.cs" />
+ <Compile Include="JsonReaderTest.cs" />
+ <Compile Include="JsonSerializerTest.cs" />
+ <Compile Include="JsonWriterTest.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="XmlNodeConverterTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Newtonsoft.Json\Newtonsoft.Json.csproj">
+ <Project>{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}</Project>
+ <Name>Newtonsoft.Json</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0fc1b84 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Newtonsoft Json.NET Test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Newtonsoft")]
+[assembly: AssemblyProduct("Newtonsoft Json.NET Test")]
+[assembly: AssemblyCopyright("Copyright © Newtonsoft 2006")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("0be3d72b-d2ef-409c-985c-d3ede89a25f1")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.3.0.0")]
+[assembly: AssemblyFileVersion("1.3.0.0")]
diff --git a/Src/Newtonsoft.Json.Tests/XmlNodeConverterTest.cs b/Src/Newtonsoft.Json.Tests/XmlNodeConverterTest.cs new file mode 100644 index 0000000..ac75d3d --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/XmlNodeConverterTest.cs @@ -0,0 +1,342 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using NUnit.Framework;
+using Newtonsoft.Json;
+using System.IO;
+using System.Xml;
+using Newtonsoft.Json.Converters;
+
+namespace Newtonsoft.Json.Tests
+{
+ [TestFixture]
+ public class XmlNodeConverterTest
+ {
+ [Test]
+ public void DocumentSerializeIndented()
+ {
+ string xml = @"<?xml version=""1.0"" standalone=""no""?>
+<?xml-stylesheet href=""classic.xsl"" type=""text/xml""?>
+<span class=""vevent"">
+ <a class=""url"" href=""http://www.web2con.com/"">
+ <span class=""summary"">Web 2.0 Conference<![CDATA[my escaped text]]></span>
+ <abbr class=""dtstart"" title=""2005-10-05"">October 5</abbr>
+ <abbr class=""dtend"" title=""2005-10-08"">7</abbr>
+ <span class=""location"">Argent Hotel, San Francisco, CA</span>
+ </a>
+</span>";
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(xml);
+
+ StringWriter sw = new StringWriter();
+
+ using (JsonWriter jsonWriter = new JsonWriter(sw))
+ {
+ jsonWriter.Formatting = Formatting.Indented;
+
+ JsonSerializer jsonSerializer = new JsonSerializer();
+ jsonSerializer.Converters.Add(new XmlNodeConverter());
+
+ jsonSerializer.Serialize(jsonWriter, doc);
+ }
+
+ string jsonText = sw.ToString();
+ string expected = @"{
+ ""?xml"": {
+ ""@version"": ""1.0"",
+ ""@standalone"": ""no""
+ },
+ ""?xml-stylesheet"": ""href=\""classic.xsl\"" type=\""text/xml\"""",
+ ""span"": {
+ ""@class"": ""vevent"",
+ ""a"": {
+ ""@class"": ""url"",
+ ""@href"": ""http://www.web2con.com/"",
+ ""span"": [
+ {
+ ""@class"": ""summary"",
+ ""#text"": ""Web 2.0 Conference"",
+ ""#cdata-section"": ""my escaped text""
+ },
+ {
+ ""@class"": ""location"",
+ ""#text"": ""Argent Hotel, San Francisco, CA""
+ }
+ ],
+ ""abbr"": [
+ {
+ ""@class"": ""dtstart"",
+ ""@title"": ""2005-10-05"",
+ ""#text"": ""October 5""
+ },
+ {
+ ""@class"": ""dtend"",
+ ""@title"": ""2005-10-08"",
+ ""#text"": ""7""
+ }
+ ]
+ }
+ }
+}";
+
+ Assert.AreEqual(expected, jsonText);
+
+ Console.WriteLine("DocumentSerializeIndented");
+ Console.WriteLine(jsonText);
+ Console.WriteLine();
+ }
+
+ [Test]
+ public void SerializeNodeTypes()
+ {
+ XmlDocument doc = new XmlDocument();
+ string jsonText;
+
+ Console.WriteLine("SerializeNodeTypes");
+
+ // XmlAttribute
+ XmlAttribute attribute = doc.CreateAttribute("msdata:IsDataSet");
+ attribute.Value = "true";
+
+ jsonText = JavaScriptConvert.SerializeXmlNode(attribute);
+
+ Console.WriteLine(jsonText);
+ Assert.AreEqual(@"{""@msdata:IsDataSet"":""true""}", jsonText);
+
+
+ // XmlProcessingInstruction
+ XmlProcessingInstruction instruction = doc.CreateProcessingInstruction("xml-stylesheet", @"href=""classic.xsl"" type=""text/xml""");
+
+ jsonText = JavaScriptConvert.SerializeXmlNode(instruction);
+
+ Console.WriteLine(jsonText);
+ Assert.AreEqual(@"{""?xml-stylesheet"":""href=\""classic.xsl\"" type=\""text/xml\""""}", jsonText);
+
+
+ // XmlProcessingInstruction
+ XmlCDataSection cDataSection = doc.CreateCDataSection("<Kiwi>true</Kiwi>");
+
+ jsonText = JavaScriptConvert.SerializeXmlNode(cDataSection);
+
+ Console.WriteLine(jsonText);
+ Assert.AreEqual(@"{""#cdata-section"":""<Kiwi>true</Kiwi>""}", jsonText);
+
+
+ // XmlElement
+ XmlElement element = doc.CreateElement("xs:Choice");
+ element.SetAttributeNode(attribute);
+
+ element.AppendChild(instruction);
+ element.AppendChild(cDataSection);
+
+ jsonText = JavaScriptConvert.SerializeXmlNode(element);
+
+ Console.WriteLine(jsonText);
+ Assert.AreEqual(@"{""xs:Choice"":{""@msdata:IsDataSet"":""true"",""?xml-stylesheet"":""href=\""classic.xsl\"" type=\""text/xml\"""",""#cdata-section"":""<Kiwi>true</Kiwi>""}}", jsonText);
+ }
+
+ [Test]
+ public void DocumentFragmentSerialize()
+ {
+ XmlDocument doc = new XmlDocument();
+
+ XmlDocumentFragment fragement = doc.CreateDocumentFragment();
+
+ fragement.InnerXml = "<Item>widget</Item><Item>widget</Item>";
+
+ string jsonText = JavaScriptConvert.SerializeXmlNode(fragement);
+
+ string expected = @"{""Item"":[""widget"",""widget""]}";
+
+ Assert.AreEqual(expected, jsonText);
+
+ Console.WriteLine("DocumentFragmentSerialize");
+ Console.WriteLine(jsonText);
+ Console.WriteLine();
+ }
+
+ [Test]
+ public void NamespaceSerializeDeserialize()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
+<xs:schema xs:id=""SomeID""
+ xmlns=""""
+ xmlns:xs=""http://www.w3.org/2001/XMLSchema""
+ xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"">
+ <xs:element name=""MyDataSet"" msdata:IsDataSet=""true"">
+ <xs:complexType>
+ <xs:choice maxOccurs=""unbounded"">
+ <xs:element name=""customers"" >
+ <xs:complexType >
+ <xs:sequence>
+ <xs:element name=""CustomerID"" type=""xs:integer""
+ minOccurs=""0"" />
+ <xs:element name=""CompanyName"" type=""xs:string""
+ minOccurs=""0"" />
+ <xs:element name=""Phone"" type=""xs:string"" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>";
+
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(xml);
+
+ string jsonText = JavaScriptConvert.SerializeXmlNode(doc);
+
+ XmlDocument deserializedDoc = (XmlDocument)JavaScriptConvert.DeerializeXmlNode(jsonText);
+
+ Assert.AreEqual(doc.InnerXml, deserializedDoc.InnerXml);
+
+ Console.WriteLine("NamespaceSerializeDeserialize");
+ Console.WriteLine(jsonText);
+ Console.WriteLine(deserializedDoc.InnerXml);
+ Console.WriteLine();
+ }
+
+ [Test]
+ public void DocumentDeserialize()
+ {
+ string jsonText = @"{
+ ""?xml"": {
+ ""@version"": ""1.0"",
+ ""@standalone"": ""no""
+ },
+ ""span"": {
+ ""@class"": ""vevent"",
+ ""a"": {
+ ""@class"": ""url"",
+ ""@href"": ""http://www.web2con.com/"",
+ ""span"": {
+ ""@class"": ""summary"",
+ ""#text"": ""Web 2.0 Conference"",
+ ""#cdata-section"": ""my escaped text""
+ }
+ }
+ }
+}";
+
+ XmlDocument doc = (XmlDocument)JavaScriptConvert.DeerializeXmlNode(jsonText);
+
+ string expected = @"<?xml version=""1.0"" standalone=""no""?>
+<span class=""vevent"">
+ <a class=""url"" href=""http://www.web2con.com/"">
+ <span class=""summary"">Web 2.0 Conference<![CDATA[my escaped text]]></span>
+ </a>
+</span>";
+
+ string formattedXml = GetIndentedInnerXml(doc);
+
+ Console.WriteLine("DocumentDeserialize");
+ Console.WriteLine(formattedXml);
+ Console.WriteLine();
+
+ Assert.AreEqual(expected, formattedXml);
+ }
+
+ private string GetIndentedInnerXml(XmlNode node)
+ {
+ XmlWriterSettings settings = new XmlWriterSettings();
+ settings.Indent = true;
+
+ StringWriter sw = new StringWriter();
+
+ using (XmlWriter writer = XmlWriter.Create(sw, settings))
+ {
+ node.WriteTo(writer);
+ }
+
+ return sw.ToString();
+ }
+
+ [Test]
+ public void SingleTextNode()
+ {
+ string xml = @"<?xml version=""1.0"" standalone=""no""?>
+ <root>
+ <person id=""1"">
+ <name>Alan</name>
+ <url>http://www.google.com</url>
+ </person>
+ <person id=""2"">
+ <name>Louis</name>
+ <url>http://www.yahoo.com</url>
+ </person>
+ </root>";
+
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(xml);
+
+ string jsonText = JavaScriptConvert.SerializeXmlNode(doc);
+
+ XmlDocument newDoc = (XmlDocument)JavaScriptConvert.DeerializeXmlNode(jsonText);
+
+ Assert.AreEqual(doc.InnerXml, newDoc.InnerXml);
+ }
+
+ [Test]
+ public void EmptyNode()
+ {
+ string xml = @"<?xml version=""1.0"" standalone=""no""?>
+ <root>
+ <person id=""1"">
+ <name>Alan</name>
+ <url />
+ </person>
+ <person id=""2"">
+ <name>Louis</name>
+ <url>http://www.yahoo.com</url>
+ </person>
+ </root>";
+
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(xml);
+
+ string jsonText = JavaScriptConvert.SerializeXmlNode(doc);
+
+ Console.WriteLine(jsonText);
+
+ XmlDocument newDoc = (XmlDocument)JavaScriptConvert.DeerializeXmlNode(jsonText);
+
+ Assert.AreEqual(doc.InnerXml, newDoc.InnerXml);
+ }
+
+ [Test]
+ public void OtherElementDataTypes()
+ {
+ string jsonText = @"{""?xml"":{""@version"":""1.0"",""@standalone"":""no""},""root"":{""person"":[{""@id"":""1"",""Float"":2.5,""Integer"":99},{""@id"":""2"",""Boolean"":true,""date"":new Date(954374400000)}]}}";
+
+ XmlDocument newDoc = (XmlDocument)JavaScriptConvert.DeerializeXmlNode(jsonText);
+
+ string expected = @"<?xml version=""1.0"" standalone=""no""?><root><person id=""1""><Float>2.5</Float><Integer>99</Integer></person><person id=""2""><Boolean>true</Boolean><date>2000-03-30T00:00:00.0000000+12:00</date></person></root>";
+
+ Assert.AreEqual(expected, newDoc.InnerXml);
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json.sln b/Src/Newtonsoft.Json.sln new file mode 100644 index 0000000..9f268d1 --- /dev/null +++ b/Src/Newtonsoft.Json.sln @@ -0,0 +1,44 @@ +
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json", "Newtonsoft.Json\Newtonsoft.Json.csproj", "{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}"
+ ProjectSection(WebsiteProperties) = preProject
+ Debug.AspNetCompiler.Debug = "True"
+ Release.AspNetCompiler.Debug = "False"
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{620042D9-2753-48F5-BEDE-3905248781D2}"
+ ProjectSection(WebsiteProperties) = preProject
+ Debug.AspNetCompiler.Debug = "True"
+ Release.AspNetCompiler.Debug = "False"
+ EndProjectSection
+ ProjectSection(SolutionItems) = preProject
+ Lib\nunit.framework.dll = Lib\nunit.framework.dll
+ Lib\nunit.framework.xml = Lib\nunit.framework.xml
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Tests", "Newtonsoft.Json.Tests\Newtonsoft.Json.Tests.csproj", "{3E6E2335-B079-4B5B-A65A-9D586914BCBB}"
+ ProjectSection(WebsiteProperties) = preProject
+ Debug.AspNetCompiler.Debug = "True"
+ Release.AspNetCompiler.Debug = "False"
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3E6E2335-B079-4B5B-A65A-9D586914BCBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3E6E2335-B079-4B5B-A65A-9D586914BCBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3E6E2335-B079-4B5B-A65A-9D586914BCBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3E6E2335-B079-4B5B-A65A-9D586914BCBB}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Src/Newtonsoft.Json/Converters/AspNetAjaxDateTimeConverter.cs b/Src/Newtonsoft.Json/Converters/AspNetAjaxDateTimeConverter.cs new file mode 100644 index 0000000..eaaf83f --- /dev/null +++ b/Src/Newtonsoft.Json/Converters/AspNetAjaxDateTimeConverter.cs @@ -0,0 +1,59 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Globalization;
+
+namespace Newtonsoft.Json.Converters
+{
+ public class AspNetAjaxDateTimeConverter : JsonConverter
+ {
+ public override void WriteJson(JsonWriter writer, object value)
+ {
+ DateTime dateTime = (DateTime)value;
+ long javaScriptTicks = JavaScriptConvert.ConvertDateTimeToJavaScriptTicks(dateTime);
+
+ writer.WriteValue("@" + javaScriptTicks.ToString(null, CultureInfo.InvariantCulture) + "@");
+ }
+
+ public override object ReadJson(JsonReader reader, Type objectType)
+ {
+ string dateTimeText = (string)reader.Value;
+ dateTimeText = dateTimeText.Substring(1, dateTimeText.Length - 2);
+
+ long javaScriptTicks = Convert.ToInt64(dateTimeText);
+
+ return JavaScriptConvert.ConvertJavaScriptTicksToDateTime(javaScriptTicks);
+ }
+
+ public override bool CanConvert(Type valueType)
+ {
+ return typeof(DateTime).IsAssignableFrom(valueType);
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/Converters/HtmlColorConverter.cs b/Src/Newtonsoft.Json/Converters/HtmlColorConverter.cs new file mode 100644 index 0000000..434146e --- /dev/null +++ b/Src/Newtonsoft.Json/Converters/HtmlColorConverter.cs @@ -0,0 +1,45 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+
+namespace Newtonsoft.Json.Converters
+{
+ public class HtmlColorConverter : JsonConverter
+ {
+ public override void WriteJson(JsonWriter writer, object value)
+ {
+ writer.WriteValue(ColorTranslator.ToHtml((Color)value));
+ }
+
+ public override bool CanConvert(Type valueType)
+ {
+ return typeof(Color).IsAssignableFrom(valueType);
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs new file mode 100644 index 0000000..2775821 --- /dev/null +++ b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs @@ -0,0 +1,472 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using Newtonsoft.Json.Utilities;
+
+namespace Newtonsoft.Json.Converters
+{
+ public class XmlNodeConverter : JsonConverter
+ {
+ private const string TextName = "#text";
+ private const string CommentName = "#comment";
+ private const string CDataName = "#cdata-section";
+ private const string WhitespaceName = "#whitespace";
+ private const string SignificantWhitespaceName = "#significant-whitespace";
+ private const string DeclarationName = "?xml";
+
+ #region Writing
+ public override void WriteJson(JsonWriter writer, object value)
+ {
+ XmlNode node = value as XmlNode;
+
+ if (node == null)
+ throw new ArgumentException("Value must be an XmlNode", "value");
+
+ writer.WriteStartObject();
+ SerializeNode(writer, node, true);
+ writer.WriteEndObject();
+ }
+
+ private string GetPropertyName(XmlNode node)
+ {
+ switch (node.NodeType)
+ {
+ case XmlNodeType.Attribute:
+ return "@" + node.Name;
+ case XmlNodeType.CDATA:
+ return CDataName;
+ case XmlNodeType.Comment:
+ return CommentName;
+ case XmlNodeType.Element:
+ return node.Name;
+ case XmlNodeType.ProcessingInstruction:
+ return "?" + node.Name;
+ case XmlNodeType.XmlDeclaration:
+ return DeclarationName;
+ case XmlNodeType.SignificantWhitespace:
+ return SignificantWhitespaceName;
+ case XmlNodeType.Text:
+ return TextName;
+ case XmlNodeType.Whitespace:
+ return WhitespaceName;
+ default:
+ throw new JsonSerializationException("Unexpected XmlNodeType when getting node name: " + node.NodeType);
+ }
+ }
+
+ private void SerializeGroupedNodes(JsonWriter writer, XmlNode node)
+ {
+ // group nodes together by name
+ Dictionary<string, List<XmlNode>> nodesGroupedByName = new Dictionary<string, List<XmlNode>>();
+
+ for (int i = 0; i < node.ChildNodes.Count; i++)
+ {
+ XmlNode childNode = node.ChildNodes[i];
+ string nodeName = GetPropertyName(childNode);
+
+ List<XmlNode> nodes;
+ if (!nodesGroupedByName.TryGetValue(nodeName, out nodes))
+ {
+ nodes = new List<XmlNode>();
+ nodesGroupedByName.Add(nodeName, nodes);
+ }
+
+ nodes.Add(childNode);
+ }
+
+ // loop through grouped nodes. write single name instances as normal,
+ // write multiple names together in an array
+ foreach (KeyValuePair<string, List<XmlNode>> nodeNameGroup in nodesGroupedByName)
+ {
+ List<XmlNode> groupedNodes = nodeNameGroup.Value;
+
+ if (groupedNodes.Count == 1)
+ {
+ SerializeNode(writer, groupedNodes[0], true);
+ }
+ else
+ {
+ writer.WritePropertyName(nodeNameGroup.Key);
+ writer.WriteStartArray();
+
+ for (int i = 0; i < groupedNodes.Count; i++)
+ {
+ SerializeNode(writer, groupedNodes[i], false);
+ }
+
+ writer.WriteEndArray();
+ }
+ }
+ }
+
+ private void SerializeNode(JsonWriter writer, XmlNode node, bool writePropertyName)
+ {
+ switch (node.NodeType)
+ {
+ case XmlNodeType.Document:
+ case XmlNodeType.DocumentFragment:
+ SerializeGroupedNodes(writer, node);
+ break;
+ case XmlNodeType.Element:
+ if (writePropertyName)
+ writer.WritePropertyName(node.Name);
+
+ if (CollectionUtils.IsNullOrEmpty(node.Attributes) && node.ChildNodes.Count == 1
+ && node.ChildNodes[0].NodeType == XmlNodeType.Text)
+ {
+ // write elements with a single text child as a name value pair
+ writer.WriteValue(node.ChildNodes[0].Value);
+ }
+ else if (node.ChildNodes.Count == 0 && CollectionUtils.IsNullOrEmpty(node.Attributes))
+ {
+ // empty element
+ writer.WriteNull();
+ }
+ else
+ {
+ writer.WriteStartObject();
+
+ for (int i = 0; i < node.Attributes.Count; i++)
+ {
+ SerializeNode(writer, node.Attributes[i], true);
+ }
+
+ SerializeGroupedNodes(writer, node);
+
+ writer.WriteEndObject();
+ }
+
+ break;
+ case XmlNodeType.Comment:
+ if (writePropertyName)
+ writer.WriteComment(node.Value);
+ break;
+ case XmlNodeType.Attribute:
+ case XmlNodeType.Text:
+ case XmlNodeType.CDATA:
+ case XmlNodeType.ProcessingInstruction:
+ case XmlNodeType.Whitespace:
+ case XmlNodeType.SignificantWhitespace:
+ if (writePropertyName)
+ writer.WritePropertyName(GetPropertyName(node));
+ writer.WriteValue(node.Value);
+ break;
+ case XmlNodeType.XmlDeclaration:
+ XmlDeclaration declaration = (XmlDeclaration)node;
+ writer.WritePropertyName(GetPropertyName(node));
+ writer.WriteStartObject();
+
+ if (!string.IsNullOrEmpty(declaration.Version))
+ {
+ writer.WritePropertyName("@version");
+ writer.WriteValue(declaration.Version);
+ }
+ if (!string.IsNullOrEmpty(declaration.Encoding))
+ {
+ writer.WritePropertyName("@encoding");
+ writer.WriteValue(declaration.Encoding);
+ }
+ if (!string.IsNullOrEmpty(declaration.Standalone))
+ {
+ writer.WritePropertyName("@standalone");
+ writer.WriteValue(declaration.Standalone);
+ }
+
+ writer.WriteEndObject();
+ break;
+ default:
+ throw new JsonSerializationException("Unexpected XmlNodeType when serializing nodes: " + node.NodeType);
+ }
+ }
+ #endregion
+
+ #region Reading
+ public override object ReadJson(JsonReader reader, Type objectType)
+ {
+ // maybe have CanReader and a CanWrite methods so this sort of test wouldn't be necessary
+ if (objectType != typeof(XmlDocument))
+ throw new JsonSerializationException("XmlNodeConverter only supports deserializing XmlDocuments");
+
+ XmlDocument document = new XmlDocument();
+ XmlNamespaceManager manager = new XmlNamespaceManager(document.NameTable);
+ reader.Read();
+
+ DeserializeNode(reader, document, manager, document);
+
+ return document;
+ }
+
+ private void DeserializeValue(JsonReader reader, XmlDocument document, XmlNamespaceManager manager, string propertyName, XmlNode currentNode)
+ {
+ switch (propertyName)
+ {
+ case TextName:
+ currentNode.AppendChild(document.CreateTextNode(reader.Value.ToString()));
+ break;
+ case CDataName:
+ currentNode.AppendChild(document.CreateCDataSection(reader.Value.ToString()));
+ break;
+ case WhitespaceName:
+ currentNode.AppendChild(document.CreateWhitespace(reader.Value.ToString()));
+ break;
+ case SignificantWhitespaceName:
+ currentNode.AppendChild(document.CreateSignificantWhitespace(reader.Value.ToString()));
+ break;
+ default:
+ // processing instructions and the xml declaration start with ?
+ if (propertyName[0] == '?')
+ {
+ if (propertyName == DeclarationName)
+ {
+ string version = null;
+ string encoding = null;
+ string standalone = null;
+ while (reader.Read() && reader.TokenType != JsonToken.EndObject)
+ {
+ switch (reader.Value.ToString())
+ {
+ case "@version":
+ reader.Read();
+ version = reader.Value.ToString();
+ break;
+ case "@encoding":
+ reader.Read();
+ encoding = reader.Value.ToString();
+ break;
+ case "@standalone":
+ reader.Read();
+ standalone = reader.Value.ToString();
+ break;
+ default:
+ throw new JsonSerializationException("Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value);
+ }
+ }
+
+ XmlDeclaration declaration = document.CreateXmlDeclaration(version, encoding, standalone);
+ currentNode.AppendChild(declaration);
+ }
+ else
+ {
+ XmlProcessingInstruction instruction = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString());
+ currentNode.AppendChild(instruction);
+ }
+ }
+ else
+ {
+ // deserialize xml element
+ bool finishedAttributes = false;
+ bool finishedElement = false;
+ string elementPrefix = GetPrefix(propertyName);
+ Dictionary<string, string> attributeNameValues = new Dictionary<string, string>();
+
+ // a string token means the element only has a single text child
+ if (reader.TokenType != JsonToken.String
+ && reader.TokenType != JsonToken.Null
+ && reader.TokenType != JsonToken.Boolean
+ && reader.TokenType != JsonToken.Integer
+ && reader.TokenType != JsonToken.Float
+ && reader.TokenType != JsonToken.Date)
+ {
+ // read properties until first non-attribute is encountered
+ while (!finishedAttributes && !finishedElement && reader.Read())
+ {
+ switch (reader.TokenType)
+ {
+ case JsonToken.PropertyName:
+ string attributeName = reader.Value.ToString();
+
+ if (attributeName[0] == '@')
+ {
+ attributeName = attributeName.Substring(1);
+ reader.Read();
+ string attributeValue = reader.Value.ToString();
+ attributeNameValues.Add(attributeName, attributeValue);
+
+ string namespacePrefix;
+
+ if (IsNamespaceAttribute(attributeName, out namespacePrefix))
+ {
+ manager.AddNamespace(namespacePrefix, attributeValue);
+ }
+ }
+ else
+ {
+ finishedAttributes = true;
+ }
+ break;
+ case JsonToken.EndObject:
+ finishedElement = true;
+ break;
+ default:
+ throw new JsonSerializationException("Unexpected JsonToken: " + reader.TokenType);
+ }
+ }
+ }
+
+ // have to wait until attributes have been parsed before creating element
+ // attributes may contain namespace info used by the element
+ XmlElement element = (!string.IsNullOrEmpty(elementPrefix))
+ ? document.CreateElement(propertyName, manager.LookupNamespace(elementPrefix))
+ : document.CreateElement(propertyName);
+
+ currentNode.AppendChild(element);
+
+ // add attributes to newly created element
+ foreach (KeyValuePair<string, string> nameValue in attributeNameValues)
+ {
+ string attributePrefix = GetPrefix(nameValue.Key);
+
+ XmlAttribute attribute = (!string.IsNullOrEmpty(attributePrefix))
+ ? document.CreateAttribute(nameValue.Key, manager.LookupNamespace(attributePrefix))
+ : document.CreateAttribute(nameValue.Key);
+
+ attribute.Value = nameValue.Value;
+
+ element.SetAttributeNode(attribute);
+ }
+
+ if (reader.TokenType == JsonToken.String)
+ {
+ element.AppendChild(document.CreateTextNode(reader.Value.ToString()));
+ }
+ else if (reader.TokenType == JsonToken.Integer)
+ {
+ element.AppendChild(document.CreateTextNode(XmlConvert.ToString((long)reader.Value)));
+ }
+ else if (reader.TokenType == JsonToken.Float)
+ {
+ element.AppendChild(document.CreateTextNode(XmlConvert.ToString((double)reader.Value)));
+ }
+ else if (reader.TokenType == JsonToken.Boolean)
+ {
+ element.AppendChild(document.CreateTextNode(XmlConvert.ToString((bool)reader.Value)));
+ }
+ else if (reader.TokenType == JsonToken.Date)
+ {
+ element.AppendChild(document.CreateTextNode(XmlConvert.ToString((DateTime)reader.Value)));
+ }
+ else if (reader.TokenType == JsonToken.Null)
+ {
+ // empty element. do nothing
+ }
+ else
+ {
+ // finished element will have no children to deserialize
+ if (!finishedElement)
+ {
+ manager.PushScope();
+
+ DeserializeNode(reader, document, manager, element);
+
+ manager.PopScope();
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ private void DeserializeNode(JsonReader reader, XmlDocument document, XmlNamespaceManager manager, XmlNode currentNode)
+ {
+ do
+ {
+ switch (reader.TokenType)
+ {
+ case JsonToken.PropertyName:
+ string propertyName = reader.Value.ToString();
+ reader.Read();
+
+ if (reader.TokenType == JsonToken.StartArray)
+ {
+ while (reader.Read() && reader.TokenType != JsonToken.EndArray)
+ {
+ DeserializeValue(reader, document, manager, propertyName, currentNode);
+ }
+ }
+ else
+ {
+ DeserializeValue(reader, document, manager, propertyName, currentNode);
+ }
+ break;
+ //case JsonToken.String:
+ // DeserializeValue(reader, document, manager, TextName, currentNode);
+ // break;
+ case JsonToken.EndObject:
+ case JsonToken.EndArray:
+ return;
+ default:
+ throw new JsonSerializationException("Unexpected JsonToken when deserializing node: " + reader.TokenType);
+ }
+ } while (reader.TokenType == JsonToken.PropertyName || reader.Read());
+ // don't read if current token is a property. token was already read when parsing element attributes
+ }
+
+ /// <summary>
+ /// Checks if the attributeName is a namespace attribute.
+ /// </summary>
+ /// <param name="attributeName">Attribute name to test.</param>
+ /// <param name="prefix">The attribute name prefix if it has one, otherwise an empty string.</param>
+ /// <returns>True if attribute name is for a namespace attribute, otherwise false.</returns>
+ private bool IsNamespaceAttribute(string attributeName, out string prefix)
+ {
+ if (attributeName.StartsWith("xmlns", StringComparison.Ordinal))
+ {
+ if (attributeName.Length == 5)
+ {
+ prefix = string.Empty;
+ return true;
+ }
+ else if (attributeName[5] == ':')
+ {
+ prefix = attributeName.Substring(6, attributeName.Length - 6);
+ return true;
+ }
+ }
+ prefix = null;
+ return false;
+ }
+
+ private string GetPrefix(string qualifiedName)
+ {
+ int colonPosition = qualifiedName.IndexOf(':');
+
+ if ((colonPosition == -1 || colonPosition == 0) || (qualifiedName.Length - 1) == colonPosition)
+ return string.Empty;
+ else
+ return qualifiedName.Substring(0, colonPosition);
+ }
+ #endregion
+
+ public override bool CanConvert(Type valueType)
+ {
+ return typeof(XmlNode).IsAssignableFrom(valueType);
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/Identifier.cs b/Src/Newtonsoft.Json/Identifier.cs new file mode 100644 index 0000000..b74df37 --- /dev/null +++ b/Src/Newtonsoft.Json/Identifier.cs @@ -0,0 +1,102 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Web;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Web.UI.WebControls;
+using System.ComponentModel;
+
+namespace Newtonsoft.Json
+{
+ public class Identifier
+ {
+ private string _name;
+
+ public string Name
+ {
+ get { return _name; }
+ }
+
+ public Identifier(string name)
+ {
+ _name = name;
+ }
+
+ private static bool IsAsciiLetter(char c)
+ {
+ return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
+ }
+
+ public override bool Equals(object obj)
+ {
+ Identifier function = obj as Identifier;
+
+ return Equals(function);
+ }
+
+ public bool Equals(Identifier function)
+ {
+ return (_name == function.Name);
+ }
+
+ public static bool Equals(Identifier a, Identifier b)
+ {
+ if (a == b)
+ return true;
+
+ if (a != null && b != null)
+ return a.Equals(b);
+
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return _name.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return _name;
+ }
+
+ public static bool operator ==(Identifier a, Identifier b)
+ {
+ return Identifier.Equals(a, b);
+ }
+
+ public static bool operator !=(Identifier a, Identifier b)
+ {
+ return !Identifier.Equals(a, b);
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/JavaScriptArray.cs b/Src/Newtonsoft.Json/JavaScriptArray.cs new file mode 100644 index 0000000..6456cdd --- /dev/null +++ b/Src/Newtonsoft.Json/JavaScriptArray.cs @@ -0,0 +1,64 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json
+{
+ /// <summary>
+ /// Represents a JavaScript array.
+ /// </summary>
+ public class JavaScriptArray : List<object>
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JavaScriptObject"/> class.
+ /// </summary>
+ public JavaScriptArray()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JavaScriptArray"/> class that
+ /// contains elements copied from the specified collection.
+ /// </summary>
+ /// <param name="collection">The collection whose elements are copied to the new array.</param>
+ public JavaScriptArray(IEnumerable<object> collection)
+ : base(collection)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JavaScriptArray"/> class that
+ /// is empty and has the specified initial capacity.
+ /// </summary>
+ /// <param name="capacity">The number of elements that the new array can initially store.</param>
+ public JavaScriptArray(int capacity)
+ : base(capacity)
+ {
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/JavaScriptConstructor.cs b/Src/Newtonsoft.Json/JavaScriptConstructor.cs new file mode 100644 index 0000000..dd5b2b4 --- /dev/null +++ b/Src/Newtonsoft.Json/JavaScriptConstructor.cs @@ -0,0 +1,81 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json
+{
+ /// <summary>
+ /// Represents a JavaScript constructor.
+ /// </summary>
+ public class JavaScriptConstructor
+ {
+ private string _name;
+ private JavaScriptParameters _parameters;
+
+ public JavaScriptParameters Parameters
+ {
+ get { return _parameters; }
+ }
+
+ public string Name
+ {
+ get { return _name; }
+ }
+
+ public JavaScriptConstructor(string name, JavaScriptParameters parameters)
+ {
+ if (name == null)
+ throw new ArgumentNullException("name");
+
+ if (name.Length == 0)
+ throw new ArgumentException("Constructor name cannot be empty.", "name");
+
+ _name = name;
+ _parameters = parameters ?? JavaScriptParameters.Empty;
+ }
+
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb.Append("new ");
+ sb.Append(_name);
+ sb.Append("(");
+ if (_parameters != null)
+ {
+ for (int i = 0; i < _parameters.Count; i++)
+ {
+ sb.Append(_parameters[i]);
+ }
+ }
+ sb.Append(")");
+
+ return sb.ToString();
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/JavaScriptConvert.cs b/Src/Newtonsoft.Json/JavaScriptConvert.cs new file mode 100644 index 0000000..ea1f7df --- /dev/null +++ b/Src/Newtonsoft.Json/JavaScriptConvert.cs @@ -0,0 +1,448 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+using System.Web.UI.WebControls;
+using System.Collections;
+using System.IO;
+using System.Globalization;
+using System.Runtime.Serialization;
+using System.Reflection;
+using System.Data.SqlTypes;
+using Newtonsoft.Json.Utilities;
+using System.Xml;
+using Newtonsoft.Json.Converters;
+
+namespace Newtonsoft.Json
+{
+ /// <summary>
+ /// Provides methods for converting between common language runtime types and JavaScript types.
+ /// </summary>
+ public static class JavaScriptConvert
+ {
+ /// <summary>
+ /// Represents JavaScript's boolean value true as a string. This field is read-only.
+ /// </summary>
+ public static readonly string True;
+
+ /// <summary>
+ /// Represents JavaScript's boolean value false as a string. This field is read-only.
+ /// </summary>
+ public static readonly string False;
+
+ /// <summary>
+ /// Represents JavaScript's null as a string. This field is read-only.
+ /// </summary>
+ public static readonly string Null;
+
+ /// <summary>
+ /// Represents JavaScript's undefined as a string. This field is read-only.
+ /// </summary>
+ public static readonly string Undefined;
+
+ internal static long InitialJavaScriptDateTicks;
+ internal static DateTime MinimumJavaScriptDate;
+
+ static JavaScriptConvert()
+ {
+ True = "true";
+ False = "false";
+ Null = "null";
+ Undefined = "undefined";
+
+ InitialJavaScriptDateTicks = (new DateTime(1970, 1, 1)).Ticks;
+ MinimumJavaScriptDate = new DateTime(100, 1, 1);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="DateTime"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="DateTime"/>.</returns>
+ public static string ToString(DateTime value)
+ {
+ long javaScriptTicks = ConvertDateTimeToJavaScriptTicks(value);
+
+ return "new Date(" + javaScriptTicks + ")";
+ }
+
+ internal static long ConvertDateTimeToJavaScriptTicks(DateTime dateTime)
+ {
+ if (dateTime < MinimumJavaScriptDate)
+ dateTime = MinimumJavaScriptDate;
+
+ long javaScriptTicks = (dateTime.Ticks - InitialJavaScriptDateTicks) / (long)10000;
+
+ return javaScriptTicks;
+ }
+
+ internal static DateTime ConvertJavaScriptTicksToDateTime(long javaScriptTicks)
+ {
+ DateTime dateTime = new DateTime((javaScriptTicks * 10000) + InitialJavaScriptDateTicks);
+
+ return dateTime;
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Boolean"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="Boolean"/>.</returns>
+ public static string ToString(bool value)
+ {
+ return (value) ? True : False;
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Char"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="Char"/>.</returns>
+ public static string ToString(char value)
+ {
+ return ToString(char.ToString(value));
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Enum"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="Enum"/>.</returns>
+ public static string ToString(Enum value)
+ {
+ return value.ToString();
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Int32"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="Int32"/>.</returns>
+ public static string ToString(int value)
+ {
+ return value.ToString(null, CultureInfo.InvariantCulture);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Int16"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="Int16"/>.</returns>
+ public static string ToString(short value)
+ {
+ return value.ToString(null, CultureInfo.InvariantCulture);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="UInt16"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="UInt16"/>.</returns>
+ public static string ToString(ushort value)
+ {
+ return value.ToString(null, CultureInfo.InvariantCulture);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="UInt32"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="UInt32"/>.</returns>
+ public static string ToString(uint value)
+ {
+ return value.ToString(null, CultureInfo.InvariantCulture);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Int64"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="Int64"/>.</returns>
+ public static string ToString(long value)
+ {
+ return value.ToString(null, CultureInfo.InvariantCulture);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="UInt64"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="UInt64"/>.</returns>
+ public static string ToString(ulong value)
+ {
+ return value.ToString(null, CultureInfo.InvariantCulture);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Single"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="Single"/>.</returns>
+ public static string ToString(float value)
+ {
+ return value.ToString(null, CultureInfo.InvariantCulture);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Double"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="Double"/>.</returns>
+ public static string ToString(double value)
+ {
+ return value.ToString(null, CultureInfo.InvariantCulture);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Byte"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="Byte"/>.</returns>
+ public static string ToString(byte value)
+ {
+ return value.ToString(null, CultureInfo.InvariantCulture);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="SByte"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="SByte"/>.</returns>
+ public static string ToString(sbyte value)
+ {
+ return value.ToString(null, CultureInfo.InvariantCulture);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Decimal"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="SByte"/>.</returns>
+ public static string ToString(decimal value)
+ {
+ return value.ToString(null, CultureInfo.InvariantCulture);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Guid"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="Guid"/>.</returns>
+ public static string ToString(Guid value)
+ {
+ return '"' + value.ToString("D", CultureInfo.InvariantCulture) + '"';
+ }
+
+ /// <summary>
+ /// Converts the <see cref="String"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="String"/>.</returns>
+ public static string ToString(string value)
+ {
+ return ToString(value, '"');
+ }
+
+ /// <summary>
+ /// Converts the <see cref="String"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <param name="delimter">The string delimiter character.</param>
+ /// <returns>A Json string representation of the <see cref="String"/>.</returns>
+ public static string ToString(string value, char delimter)
+ {
+ return JavaScriptUtils.ToEscapedJavaScriptString(value, delimter, true);
+ }
+
+ /// <summary>
+ /// Converts the <see cref="Object"/> to it's JavaScript string representation.
+ /// </summary>
+ /// <param name="value">The value to convert.</param>
+ /// <returns>A Json string representation of the <see cref="Object"/>.</returns>
+ public static string ToString(object value)
+ {
+ if (value == null)
+ {
+ return Null;
+ }
+ else if (value is IConvertible)
+ {
+ IConvertible convertible = value as IConvertible;
+
+ switch (convertible.GetTypeCode())
+ {
+ case TypeCode.String:
+ return ToString((string)convertible);
+ case TypeCode.Char:
+ return ToString((char)convertible);
+ case TypeCode.Boolean:
+ return ToString((bool)convertible);
+ case TypeCode.SByte:
+ return ToString((sbyte)convertible);
+ case TypeCode.Int16:
+ return ToString((short)convertible);
+ case TypeCode.UInt16:
+ return ToString((ushort)convertible);
+ case TypeCode.Int32:
+ return ToString((int)convertible);
+ case TypeCode.Byte:
+ return ToString((byte)convertible);
+ case TypeCode.UInt32:
+ return ToString((uint)convertible);
+ case TypeCode.Int64:
+ return ToString((long)convertible);
+ case TypeCode.UInt64:
+ return ToString((ulong)convertible);
+ case TypeCode.Single:
+ return ToString((float)convertible);
+ case TypeCode.Double:
+ return ToString((double)convertible);
+ case TypeCode.DateTime:
+ return ToString((DateTime)convertible);
+ case TypeCode.Decimal:
+ return ToString((decimal)convertible);
+ }
+ }
+
+ throw new ArgumentException(string.Format("Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.", value.GetType()));
+ }
+
+ /// <summary>
+ /// Serializes the specified object to a Json object.
+ /// </summary>
+ /// <param name="value">The object to serialize.</param>
+ /// <returns>A Json string representation of the object.</returns>
+ public static string SerializeObject(object value)
+ {
+ return SerializeObject(value, null);
+ }
+
+ public static string SerializeObject(object value, params JsonConverter[] converters)
+ {
+ StringWriter sw = new StringWriter(CultureInfo.InvariantCulture);
+ JsonSerializer jsonSerializer = new JsonSerializer();
+
+ if (!CollectionUtils.IsNullOrEmpty<JsonConverter>(converters))
+ {
+ for (int i = 0; i < converters.Length; i++)
+ {
+ jsonSerializer.Converters.Add(converters[i]);
+ }
+ }
+
+ using (JsonWriter jsonWriter = new JsonWriter(sw))
+ {
+ //jsonWriter.Formatting = Formatting.Indented;
+ jsonSerializer.Serialize(jsonWriter, value);
+ }
+
+ return sw.ToString();
+ }
+
+ /// <summary>
+ /// Deserializes the specified object to a Json object.
+ /// </summary>
+ /// <param name="value">The object to deserialize.</param>
+ /// <returns>The deserialized object from the Json string.</returns>
+ public static object DeserializeObject(string value)
+ {
+ return DeserializeObject(value, null, null);
+ }
+
+ /// <summary>
+ /// Deserializes the specified object to a Json object.
+ /// </summary>
+ /// <param name="value">The object to deserialize.</param>
+ /// <param name="type">The <see cref="Type"/> of object being deserialized.</param>
+ /// <returns>The deserialized object from the Json string.</returns>
+ public static object DeserializeObject(string value, Type type)
+ {
+ return DeserializeObject(value, type, null);
+ }
+
+ /// <summary>
+ /// Deserializes the specified object to a Json object.
+ /// </summary>
+ /// <typeparam name="T">The type of the object to deserialize.</typeparam>
+ /// <param name="value">The object to deserialize.</param>
+ /// <returns>The deserialized object from the Json string.</returns>
+ public static T DeserializeObject<T>(string value)
+ {
+ return DeserializeObject<T>(value, null);
+ }
+
+ /// <summary>
+ /// Deserializes the specified object to a Json object.
+ /// </summary>
+ /// <typeparam name="T">The type of the object to deserialize.</typeparam>
+ /// <param name="value">The object to deserialize.</param>
+ /// <param name="converters">Converters to use while deserializing.</param>
+ /// <returns>The deserialized object from the Json string.</returns>
+ public static T DeserializeObject<T>(string value, params JsonConverter[] converters)
+ {
+ return (T)DeserializeObject(value, typeof(T), converters);
+ }
+
+ public static object DeserializeObject(string value, Type type, params JsonConverter[] converters)
+ {
+ StringReader sr = new StringReader(value);
+ JsonSerializer jsonSerializer = new JsonSerializer();
+
+ if (!CollectionUtils.IsNullOrEmpty<JsonConverter>(converters))
+ {
+ for (int i = 0; i < converters.Length; i++)
+ {
+ jsonSerializer.Converters.Add(converters[i]);
+ }
+ }
+
+ object deserializedValue;
+
+ using (JsonReader jsonReader = new JsonReader(sr))
+ {
+ deserializedValue = jsonSerializer.Deserialize(jsonReader, type);
+ }
+
+ return deserializedValue;
+ }
+
+ public static string SerializeXmlNode(XmlNode node)
+ {
+ XmlNodeConverter converter = new XmlNodeConverter();
+
+ return SerializeObject(node, converter);
+ }
+
+ public static XmlNode DeerializeXmlNode(string value)
+ {
+ XmlNodeConverter converter = new XmlNodeConverter();
+
+ return (XmlDocument)DeserializeObject(value, typeof(XmlDocument), converter);
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/JavaScriptObject.cs b/Src/Newtonsoft.Json/JavaScriptObject.cs new file mode 100644 index 0000000..b1625ba --- /dev/null +++ b/Src/Newtonsoft.Json/JavaScriptObject.cs @@ -0,0 +1,55 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json
+{
+ /// <summary>
+ /// Represents a JavaScript object.
+ /// </summary>
+ public class JavaScriptObject : Dictionary<string, object>
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JavaScriptObject"/> class.
+ /// </summary>
+ public JavaScriptObject()
+ : base(EqualityComparer<string>.Default)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JavaScriptObject"/> class that
+ /// contains values copied from the specified <see cref="JavaScriptObject"/>.
+ /// </summary>
+ /// <param name="javaScriptObject">The <see cref="JavaScriptObject"/> whose elements are copied to the new object.</param>
+ public JavaScriptObject(JavaScriptObject javaScriptObject)
+ : base(javaScriptObject, EqualityComparer<string>.Default)
+ {
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/JavaScriptParameters.cs b/Src/Newtonsoft.Json/JavaScriptParameters.cs new file mode 100644 index 0000000..ba0a2cd --- /dev/null +++ b/Src/Newtonsoft.Json/JavaScriptParameters.cs @@ -0,0 +1,42 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Collections.ObjectModel;
+
+namespace Newtonsoft.Json
+{
+ public class JavaScriptParameters : ReadOnlyCollection<object>
+ {
+ public static readonly JavaScriptParameters Empty = new JavaScriptParameters(new List<object>());
+
+ public JavaScriptParameters(IList<object> list)
+ : base(list)
+ {
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/JsonConverter.cs b/Src/Newtonsoft.Json/JsonConverter.cs new file mode 100644 index 0000000..bff625b --- /dev/null +++ b/Src/Newtonsoft.Json/JsonConverter.cs @@ -0,0 +1,48 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json
+{
+ public abstract class JsonConverter
+ {
+ public virtual void WriteJson(JsonWriter writer, object value)
+ {
+ JsonSerializer serializer = new JsonSerializer();
+
+ serializer.Serialize(writer, value);
+ }
+
+ public virtual object ReadJson(JsonReader reader, Type objectType)
+ {
+ throw new NotImplementedException(string.Format("{0} has not overriden FromJson method.", GetType().Name));
+ }
+
+ public abstract bool CanConvert(Type objectType);
+ }
+}
diff --git a/Src/Newtonsoft.Json/JsonConverterCollection.cs b/Src/Newtonsoft.Json/JsonConverterCollection.cs new file mode 100644 index 0000000..b19ab76 --- /dev/null +++ b/Src/Newtonsoft.Json/JsonConverterCollection.cs @@ -0,0 +1,36 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Collections.ObjectModel;
+
+namespace Newtonsoft.Json
+{
+ public class JsonConverterCollection : Collection<JsonConverter>
+ {
+ }
+}
diff --git a/Src/Newtonsoft.Json/JsonHandler.cs b/Src/Newtonsoft.Json/JsonHandler.cs new file mode 100644 index 0000000..ca2a93f --- /dev/null +++ b/Src/Newtonsoft.Json/JsonHandler.cs @@ -0,0 +1,63 @@ +using System;
+using System.Web;
+using System.Web.Caching;
+using System.Xml;
+using System.Text;
+using System.Security.Principal;
+
+namespace Newtonsoft.Json
+{
+ public abstract class JsonHandler : HandlerBase, IHttpHandler
+ {
+ public event EventHandler Error;
+
+ protected abstract void WriteResult(JsonWriter writer);
+
+ public static void JsonResponse(HttpResponse response, Action<JsonWriter> writeAction)
+ {
+ response.ClearHeaders();
+ response.ClearContent();
+
+ JsonWriter writer = new JsonWriter(response.Output);
+
+ writeAction(writer);
+
+ writer.Flush();
+ }
+
+ protected virtual void OnError(EventArgs e)
+ {
+ if (Error != null)
+ {
+ Error(this, e);
+ }
+ }
+
+ void IHttpHandler.ProcessRequest(HttpContext context)
+ {
+ if (context == null)
+ throw new ArgumentNullException("context");
+
+ Context = context;
+
+ try
+ {
+ JsonHandler.JsonResponse(context.Response, new Action<JsonWriter>(WriteResult));
+ }
+ catch (Exception exception)
+ {
+ context.AddError(exception);
+ OnError(EventArgs.Empty);
+ if (context.Error != null)
+ {
+ throw new HttpUnhandledException("blah", exception);
+ }
+ }
+ }
+
+ bool IHttpHandler.IsReusable
+ {
+ get { return false; }
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/JsonIgnoreAttribute.cs b/Src/Newtonsoft.Json/JsonIgnoreAttribute.cs new file mode 100644 index 0000000..8262998 --- /dev/null +++ b/Src/Newtonsoft.Json/JsonIgnoreAttribute.cs @@ -0,0 +1,36 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json
+{
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
+ public sealed class JsonIgnoreAttribute : Attribute
+ {
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/JsonPropertyAttribute.cs b/Src/Newtonsoft.Json/JsonPropertyAttribute.cs new file mode 100644 index 0000000..08f8094 --- /dev/null +++ b/Src/Newtonsoft.Json/JsonPropertyAttribute.cs @@ -0,0 +1,21 @@ +using System;
+
+namespace Newtonsoft.Json
+{
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
+ public sealed class JsonPropertyAttribute : Attribute
+ {
+ private string _propertyName;
+
+ public string PropertyName
+ {
+ get { return _propertyName; }
+ set { _propertyName = value; }
+ }
+
+ public JsonPropertyAttribute(string propertyName)
+ {
+ _propertyName = propertyName;
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/JsonReader.cs b/Src/Newtonsoft.Json/JsonReader.cs new file mode 100644 index 0000000..197da20 --- /dev/null +++ b/Src/Newtonsoft.Json/JsonReader.cs @@ -0,0 +1,897 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Xml;
+using System.Globalization;
+
+namespace Newtonsoft.Json
+{
+ /// <summary>
+ /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data.
+ /// </summary>
+ public class JsonReader : IDisposable
+ {
+ private enum State
+ {
+ Start,
+ Complete,
+ Property,
+ ObjectStart,
+ Object,
+ ArrayStart,
+ Array,
+ Closed,
+ PostValue,
+ Constructor,
+ ConstructorEnd,
+ Error,
+ Finished
+ }
+
+ private TextReader _reader;
+ private char _currentChar;
+
+ // current Token data
+ private JsonToken _token;
+ private object _value;
+ private Type _valueType;
+ private char _quoteChar;
+ private StringBuffer _buffer;
+ //private StringBuilder _testBuffer;
+ private State _currentState;
+
+ private int _top;
+ private List<JsonType> _stack;
+
+ /// <summary>
+ /// Gets the quotation mark character used to enclose the value of a string.
+ /// </summary>
+ public char QuoteChar
+ {
+ get { return _quoteChar; }
+ }
+
+ /// <summary>
+ /// Gets the type of the current Json token.
+ /// </summary>
+ public JsonToken TokenType
+ {
+ get { return _token; }
+ }
+
+ /// <summary>
+ /// Gets the text value of the current Json token.
+ /// </summary>
+ public object Value
+ {
+ get { return _value; }
+ }
+
+ /// <summary>
+ /// Gets The Common Language Runtime (CLR) type for the current Json token.
+ /// </summary>
+ public Type ValueType
+ {
+ get { return _valueType; }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JsonReader"/> class with the specified <see cref="TextReader"/>.
+ /// </summary>
+ /// <param name="reader">The <c>TextReader</c> containing the XML data to read.</param>
+ public JsonReader(TextReader reader)
+ {
+ if (reader == null)
+ throw new ArgumentNullException("reader");
+
+ _reader = reader;
+ _buffer = new StringBuffer(4096);
+ //_testBuffer = new StringBuilder();
+ _currentState = State.Start;
+ _stack = new List<JsonType>();
+ _top = 0;
+ Push(JsonType.None);
+ }
+
+ private void Push(JsonType value)
+ {
+ _stack.Add(value);
+ _top++;
+ }
+
+ private JsonType Pop()
+ {
+ JsonType value = Peek();
+ _stack.RemoveAt(_stack.Count - 1);
+ _top--;
+
+ return value;
+ }
+
+ private JsonType Peek()
+ {
+ return _stack[_top - 1];
+ }
+
+ private void ParseString(char quote)
+ {
+ bool stringTerminated = false;
+
+ while (!stringTerminated && MoveNext())
+ {
+ switch (_currentChar)
+ {
+ //case 0:
+ //case 0x0A:
+ //case 0x0D:
+ // throw new JsonReaderException("Unterminated string");
+ case '\\':
+ if (MoveNext())
+ {
+ switch (_currentChar)
+ {
+ case 'b':
+ _buffer.Append('\b');
+ break;
+ case 't':
+ _buffer.Append('\t');
+ break;
+ case 'n':
+ _buffer.Append('\n');
+ break;
+ case 'f':
+ _buffer.Append('\f');
+ break;
+ case 'r':
+ _buffer.Append('\r');
+ break;
+ case 'u':
+ //_buffer.Append((char) Integer.parseInt(next(4), 16));
+ break;
+ case 'x':
+ //_buffer.Append((char) Integer.parseInt(next(2), 16));
+ break;
+ default:
+ _buffer.Append(_currentChar);
+ break;
+ }
+ }
+ else
+ {
+ throw new JsonReaderException("Unterminated string. Expected delimiter: " + quote);
+ }
+ break;
+ case '"':
+ case '\'':
+ if (_currentChar == quote)
+ stringTerminated = true;
+ else
+ goto default;
+ break;
+ default:
+ _buffer.Append(_currentChar);
+ break;
+ }
+ }
+
+ if (!stringTerminated)
+ throw new JsonReaderException("Unterminated string. Expected delimiter: " + quote);
+
+ ClearCurrentChar();
+ _currentState = State.PostValue;
+ _token = JsonToken.String;
+ _value = _buffer.ToString();
+ _buffer.Position = 0;
+ _valueType = typeof(string);
+ _quoteChar = quote;
+ }
+
+ private bool MoveNext()
+ {
+ int value = _reader.Read();
+
+ if (value != -1)
+ {
+ _currentChar = (char)value;
+ //_testBuffer.Append(_currentChar);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ private bool HasNext()
+ {
+ return (_reader.Peek() != -1);
+ }
+
+ private char PeekNext()
+ {
+ return (char)_reader.Peek();
+ }
+
+ private void ClearCurrentChar()
+ {
+ _currentChar = '\0';
+ }
+
+ private bool MoveTo(char value)
+ {
+ while (MoveNext())
+ {
+ if (_currentChar == value)
+ return true;
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Reads the next Json token from the stream.
+ /// </summary>
+ /// <returns></returns>
+ public bool Read()
+ {
+ while (true)
+ {
+ if (_currentChar == '\0')
+ {
+ if (!MoveNext())
+ return false;
+ }
+
+ switch (_currentState)
+ {
+ case State.Start:
+ case State.Property:
+ case State.Array:
+ case State.ArrayStart:
+ return ParseValue();
+ case State.Complete:
+ break;
+ case State.Object:
+ case State.ObjectStart:
+ return ParseObject();
+ case State.PostValue:
+ // returns true if it hits
+ // end of object or array
+ if (ParsePostValue())
+ return true;
+ break;
+ case State.Closed:
+ break;
+ case State.Error:
+ break;
+ default:
+ throw new JsonReaderException("Unexpected state: " + _currentState);
+ }
+ }
+ }
+
+ private bool ParsePostValue()
+ {
+ do
+ {
+ switch (_currentChar)
+ {
+ case '}':
+ SetToken(JsonToken.EndObject);
+ ClearCurrentChar();
+ return true;
+ case ']':
+ SetToken(JsonToken.EndArray);
+ ClearCurrentChar();
+ return true;
+ case '/':
+ ParseComment();
+ return true;
+ case ',':
+ // finished paring
+ SetStateBasedOnCurrent();
+ ClearCurrentChar();
+ return false;
+ default:
+ if (char.IsWhiteSpace(_currentChar))
+ {
+ // eat whitespace
+ ClearCurrentChar();
+ }
+ else
+ {
+ throw new JsonReaderException("After parsing a value an unexpected character was encoutered: " + _currentChar);
+ }
+ break;
+ }
+ } while (MoveNext());
+
+ return false;
+ }
+
+ private bool ParseObject()
+ {
+ do
+ {
+ switch (_currentChar)
+ {
+ case '}':
+ SetToken(JsonToken.EndObject);
+ return true;
+ case '/':
+ ParseComment();
+ return true;
+ case ',':
+ SetToken(JsonToken.Undefined);
+ return true;
+ default:
+ if (char.IsWhiteSpace(_currentChar))
+ {
+ // eat
+ }
+ else
+ {
+ return ParseProperty();
+ }
+ break;
+ }
+ } while (MoveNext());
+
+ return false;
+ }
+
+ private bool ParseProperty()
+ {
+ if (ValidIdentifierChar(_currentChar))
+ {
+ ParseUnquotedProperty();
+ }
+ else if (_currentChar == '"' || _currentChar == '\'')
+ {
+ ParseQuotedProperty(_currentChar);
+ }
+ else
+ {
+ throw new JsonReaderException("Invalid property identifier character: " + _currentChar);
+ }
+
+ // finished property. move to colon
+ if (_currentChar != ':')
+ {
+ MoveTo(':');
+ }
+
+ SetToken(JsonToken.PropertyName, _buffer.ToString());
+ _buffer.Position = 0;
+
+ return true;
+ }
+
+ private void ParseQuotedProperty(char quoteChar)
+ {
+ // parse property name until quoted char is hit
+ while (MoveNext())
+ {
+ if (_currentChar == quoteChar)
+ {
+ return;
+ }
+ else
+ {
+ _buffer.Append(_currentChar);
+ }
+ }
+
+ throw new JsonReaderException("Unclosed quoted property. Expected: " + quoteChar);
+ }
+
+ private bool ValidIdentifierChar(char value)
+ {
+ return (char.IsLetterOrDigit(_currentChar) || _currentChar == '_' || _currentChar == '$');
+ }
+
+ private void ParseUnquotedProperty()
+ {
+ // parse unquoted property name until whitespace or colon
+ _buffer.Append(_currentChar);
+
+ while (MoveNext())
+ {
+ if (char.IsWhiteSpace(_currentChar) || _currentChar == ':')
+ {
+ break;
+ }
+ else if (ValidIdentifierChar(_currentChar))
+ {
+ _buffer.Append(_currentChar);
+ }
+ else
+ {
+ throw new JsonReaderException("Invalid JavaScript property identifier character: " + _currentChar);
+ }
+ }
+ }
+
+ private void SetToken(JsonToken newToken)
+ {
+ SetToken(newToken, null);
+ }
+
+ private void SetToken(JsonToken newToken, object value)
+ {
+ _token = newToken;
+
+ switch (newToken)
+ {
+ case JsonToken.StartObject:
+ _currentState = State.ObjectStart;
+ Push(JsonType.Object);
+ ClearCurrentChar();
+ break;
+ case JsonToken.StartArray:
+ _currentState = State.ArrayStart;
+ Push(JsonType.Array);
+ ClearCurrentChar();
+ break;
+ case JsonToken.EndObject:
+ ValidateEnd(JsonToken.EndObject);
+ ClearCurrentChar();
+ _currentState = State.PostValue;
+ break;
+ case JsonToken.EndArray:
+ ValidateEnd(JsonToken.EndArray);
+ ClearCurrentChar();
+ _currentState = State.PostValue;
+ break;
+ case JsonToken.PropertyName:
+ _currentState = State.Property;
+ ClearCurrentChar();
+ break;
+ case JsonToken.Undefined:
+ case JsonToken.Integer:
+ case JsonToken.Float:
+ case JsonToken.Boolean:
+ case JsonToken.Null:
+ case JsonToken.Constructor:
+ case JsonToken.Date:
+ _currentState = State.PostValue;
+ break;
+ }
+
+ if (value != null)
+ {
+ _value = value;
+ _valueType = value.GetType();
+ }
+ else
+ {
+ _value = null;
+ _valueType = null;
+ }
+ }
+
+ private bool ParseValue()
+ {
+ do
+ {
+ switch (_currentChar)
+ {
+ case '"':
+ case '\'':
+ ParseString(_currentChar);
+ return true;
+ case 't':
+ ParseTrue();
+ return true;
+ case 'f':
+ ParseFalse();
+ return true;
+ case 'n':
+ if (HasNext())
+ {
+ char next = PeekNext();
+
+ if (next == 'u')
+ ParseNull();
+ else if (next == 'e')
+ ParseConstructor();
+ else
+ throw new JsonReaderException("Unexpected character encountered while parsing value: " + _currentChar);
+ }
+ else
+ {
+ throw new JsonReaderException("Unexpected end");
+ }
+ return true;
+ case '/':
+ ParseComment();
+ return true;
+ case 'u':
+ ParseUndefined();
+ return true;
+ case '{':
+ SetToken(JsonToken.StartObject);
+ return true;
+ case '[':
+ SetToken(JsonToken.StartArray);
+ return true;
+ case '}':
+ SetToken(JsonToken.EndObject);
+ return true;
+ case ']':
+ SetToken(JsonToken.EndArray);
+ return true;
+ case ',':
+ SetToken(JsonToken.Undefined);
+ //ClearCurrentChar();
+ return true;
+ case ')':
+ if (_currentState == State.Constructor)
+ {
+ _currentState = State.ConstructorEnd;
+ return false;
+ }
+ else
+ {
+ throw new JsonReaderException("Unexpected character encountered while parsing value: " + _currentChar);
+ }
+ default:
+ if (char.IsWhiteSpace(_currentChar))
+ {
+ // eat
+ }
+ else if (char.IsNumber(_currentChar) || _currentChar == '-' || _currentChar == '.')
+ {
+ ParseNumber();
+ return true;
+ }
+ else
+ {
+ throw new JsonReaderException("Unexpected character encountered while parsing value: " + _currentChar);
+ }
+ break;
+ }
+ } while (MoveNext());
+
+ return false;
+ }
+
+ private bool EatWhitespace(bool oneOrMore)
+ {
+ bool whitespace = false;
+ while (char.IsWhiteSpace(_currentChar))
+ {
+ whitespace = true;
+ MoveNext();
+ }
+
+ return (!oneOrMore || whitespace);
+ }
+
+ private void ParseConstructor()
+ {
+ if (MatchValue("new", true))
+ {
+ if (EatWhitespace(true))
+ {
+ while (char.IsLetter(_currentChar))
+ {
+ _buffer.Append(_currentChar);
+ MoveNext();
+ }
+
+ string constructorName = _buffer.ToString();
+ _buffer.Position = 0;
+
+ List<object> parameters = new List<object>();
+
+ EatWhitespace(false);
+
+ if (_currentChar == '(' && MoveNext())
+ {
+ _currentState = State.Constructor;
+
+ while (ParseValue())
+ {
+ parameters.Add(_value);
+ _currentState = State.Constructor;
+ }
+
+ if (string.CompareOrdinal(constructorName, "Date") == 0)
+ {
+ long javaScriptTicks = Convert.ToInt64(parameters[0]);
+
+ DateTime date = JavaScriptConvert.ConvertJavaScriptTicksToDateTime(javaScriptTicks);
+
+ SetToken(JsonToken.Date, date);
+ }
+ else
+ {
+ JavaScriptConstructor constructor = new JavaScriptConstructor(constructorName, new JavaScriptParameters(parameters));
+
+ if (_currentState == State.ConstructorEnd)
+ {
+ SetToken(JsonToken.Constructor, constructor);
+ }
+ }
+
+ // move past ')'
+ MoveNext();
+ }
+ }
+ }
+ }
+
+ private void ParseNumber()
+ {
+ // parse until seperator character or end
+ bool end = false;
+ do
+ {
+ if (CurrentIsSeperator())
+ end = true;
+ else
+ _buffer.Append(_currentChar);
+
+ } while (!end && MoveNext());
+
+ string number = _buffer.ToString();
+ object numberValue;
+ JsonToken numberType;
+
+ if (number.IndexOf('.') == -1)
+ {
+ numberValue = Convert.ToInt64(_buffer.ToString(), CultureInfo.InvariantCulture);
+ numberType = JsonToken.Integer;
+ }
+ else
+ {
+ numberValue = Convert.ToDouble(_buffer.ToString(), CultureInfo.InvariantCulture);
+ numberType = JsonToken.Float;
+ }
+
+ _buffer.Position = 0;
+
+ SetToken(numberType, numberValue);
+ }
+
+ private void ValidateEnd(JsonToken endToken)
+ {
+ JsonType currentObject = Pop();
+
+ if (GetTypeForCloseToken(endToken) != currentObject)
+ throw new JsonReaderException(string.Format("JsonToken {0} is not valid for closing JsonType {1}.", endToken, currentObject));
+ }
+
+ private void SetStateBasedOnCurrent()
+ {
+ JsonType currentObject = Peek();
+
+ switch (currentObject)
+ {
+ case JsonType.Object:
+ _currentState = State.Object;
+ break;
+ case JsonType.Array:
+ _currentState = State.Array;
+ break;
+ case JsonType.None:
+ _currentState = State.Finished;
+ break;
+ default:
+ throw new JsonReaderException("While setting the reader state back to current object an unexpected JsonType was encountered: " + currentObject);
+ }
+ }
+
+ private JsonType GetTypeForCloseToken(JsonToken token)
+ {
+ switch (token)
+ {
+ case JsonToken.EndObject:
+ return JsonType.Object;
+ case JsonToken.EndArray:
+ return JsonType.Array;
+ default:
+ throw new JsonReaderException("Not a valid close JsonToken: " + token);
+ }
+ }
+
+ private void ParseComment()
+ {
+ // should have already parsed / character before reaching this method
+
+ MoveNext();
+
+ if (_currentChar == '*')
+ {
+ while (MoveNext())
+ {
+ if (_currentChar == '*')
+ {
+ if (MoveNext())
+ {
+ if (_currentChar == '/')
+ {
+ break;
+ }
+ else
+ {
+ _buffer.Append('*');
+ _buffer.Append(_currentChar);
+ }
+ }
+ }
+ else
+ {
+ _buffer.Append(_currentChar);
+ }
+ }
+ }
+ else
+ {
+ throw new JsonReaderException("Error parsing comment. Expected: *");
+ }
+
+ SetToken(JsonToken.Comment, _buffer.ToString());
+
+ _buffer.Position = 0;
+
+ ClearCurrentChar();
+ }
+
+ private bool MatchValue(string value)
+ {
+ int i = 0;
+ do
+ {
+ if (_currentChar != value[i])
+ {
+ break;
+ }
+ i++;
+ }
+ while (i < value.Length && MoveNext());
+
+ return (i == value.Length);
+ }
+
+ private bool MatchValue(string value, bool noTrailingNonSeperatorCharacters)
+ {
+ // will match value and then move to the next character, checking that it is a seperator character
+ bool match = MatchValue(value);
+
+ if (!noTrailingNonSeperatorCharacters)
+ return match;
+ else
+ return (match && (!MoveNext() || CurrentIsSeperator()));
+ }
+
+ private bool CurrentIsSeperator()
+ {
+ switch (_currentChar)
+ {
+ case '}':
+ case ']':
+ case ',':
+ return true;
+ case '/':
+ // check next character to see if start of a comment
+ return (HasNext() && PeekNext() == '*');
+ case ')':
+ if (_currentState == State.Constructor)
+ return true;
+ break;
+ default:
+ if (char.IsWhiteSpace(_currentChar))
+ return true;
+ break;
+ }
+
+ return false;
+ }
+
+ private void ParseTrue()
+ {
+ // check characters equal 'true'
+ // and that it is followed by either a seperator character
+ // or the text ends
+ if (MatchValue(JavaScriptConvert.True, true))
+ {
+ SetToken(JsonToken.Boolean, true);
+ }
+ else
+ {
+ throw new JsonReaderException("Error parsing boolean value.");
+ }
+ }
+
+ private void ParseNull()
+ {
+ if (MatchValue(JavaScriptConvert.Null, true))
+ {
+ SetToken(JsonToken.Null);
+ }
+ else
+ {
+ throw new JsonReaderException("Error parsing null value.");
+ }
+ }
+
+ private void ParseUndefined()
+ {
+ if (MatchValue(JavaScriptConvert.Undefined, true))
+ {
+ SetToken(JsonToken.Undefined);
+ }
+ else
+ {
+ throw new JsonReaderException("Error parsing undefined value.");
+ }
+ }
+
+ private void ParseFalse()
+ {
+ if (MatchValue(JavaScriptConvert.False, true))
+ {
+ SetToken(JsonToken.Boolean, false);
+ }
+ else
+ {
+ throw new JsonReaderException("Error parsing boolean value.");
+ }
+ }
+
+ void IDisposable.Dispose()
+ {
+ Dispose(true);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (_currentState != State.Closed && disposing)
+ Close();
+ }
+
+ /// <summary>
+ /// Changes the <see cref="State"/> to Closed.
+ /// </summary>
+ public void Close()
+ {
+ _currentState = State.Closed;
+ _token = JsonToken.None;
+ _value = null;
+ _valueType = null;
+
+ if (_reader != null)
+ _reader.Close();
+
+ if (_buffer != null)
+ _buffer.Clear();
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/JsonReaderException.cs b/Src/Newtonsoft.Json/JsonReaderException.cs new file mode 100644 index 0000000..9940c67 --- /dev/null +++ b/Src/Newtonsoft.Json/JsonReaderException.cs @@ -0,0 +1,65 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json
+{
+ /// <summary>
+ /// The exception thrown when an error occurs while reading Json text.
+ /// </summary>
+ public class JsonReaderException : Exception
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JsonReaderException"/> class.
+ /// </summary>
+ public JsonReaderException()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JsonReaderException"/> class
+ /// with a specified error message.
+ /// </summary>
+ /// <param name="message">The error message that explains the reason for the exception.</param>
+ public JsonReaderException(string message)
+ : base(message)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JsonReaderException"/> class
+ /// with a specified error message and a reference to the inner exception that is the cause of this exception.
+ /// </summary>
+ /// <param name="message">The error message that explains the reason for the exception.</param>
+ /// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
+ public JsonReaderException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/JsonSerializationException.cs b/Src/Newtonsoft.Json/JsonSerializationException.cs new file mode 100644 index 0000000..bec2635 --- /dev/null +++ b/Src/Newtonsoft.Json/JsonSerializationException.cs @@ -0,0 +1,65 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json
+{
+ /// <summary>
+ /// The exception thrown when an error occurs during Json serialization or deserialization.
+ /// </summary>
+ public class JsonSerializationException : Exception
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JsonSerializationException"/> class.
+ /// </summary>
+ public JsonSerializationException()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JsonSerializationException"/> class
+ /// with a specified error message.
+ /// </summary>
+ /// <param name="message">The error message that explains the reason for the exception.</param>
+ public JsonSerializationException(string message)
+ : base(message)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JsonSerializationException"/> class
+ /// with a specified error message and a reference to the inner exception that is the cause of this exception.
+ /// </summary>
+ /// <param name="message">The error message that explains the reason for the exception.</param>
+ /// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
+ public JsonSerializationException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/JsonSerializer.cs b/Src/Newtonsoft.Json/JsonSerializer.cs new file mode 100644 index 0000000..43dabb3 --- /dev/null +++ b/Src/Newtonsoft.Json/JsonSerializer.cs @@ -0,0 +1,649 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Collections;
+using System.Reflection;
+using System.ComponentModel;
+using Newtonsoft.Json.Utilities;
+using System.Globalization;
+
+namespace Newtonsoft.Json
+{
+ /// <summary>
+ /// Specifies reference loop handling options for the <see cref="JsonWriter"/>.
+ /// </summary>
+ public enum ReferenceLoopHandling
+ {
+ /// <summary>
+ /// Throw a <see cref="JsonSerializationException"/> when a loop is encountered.
+ /// </summary>
+ Error = 0,
+ /// <summary>
+ /// Ignore loop references and do not serialize.
+ /// </summary>
+ Ignore = 1,
+ /// <summary>
+ /// Serialize loop references.
+ /// </summary>
+ Serialize = 2
+ }
+
+ /// <summary>
+ /// Serializes and deserializes objects into and from the Json format.
+ /// The <see cref="JsonSerializer"/> enables you to control how objects are encoded into Json.
+ /// </summary>
+ public class JsonSerializer
+ {
+ private ReferenceLoopHandling _referenceLoopHandling;
+ private int _level;
+ private JsonConverterCollection _converters;
+ private Dictionary<Type, MemberMappingCollection> _typeMemberMappings;
+
+ /// <summary>
+ /// Get or set how reference loops (e.g. a class referencing itself) is handled.
+ /// </summary>
+ public ReferenceLoopHandling ReferenceLoopHandling
+ {
+ get { return _referenceLoopHandling; }
+ set
+ {
+ if (value < ReferenceLoopHandling.Error || value > ReferenceLoopHandling.Serialize)
+ {
+ throw new ArgumentOutOfRangeException("value");
+ }
+ _referenceLoopHandling = value;
+ }
+ }
+
+ public JsonConverterCollection Converters
+ {
+ get
+ {
+ if (_converters == null)
+ _converters = new JsonConverterCollection();
+
+ return _converters;
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JsonSerializer"/> class.
+ /// </summary>
+ public JsonSerializer()
+ {
+ _referenceLoopHandling = ReferenceLoopHandling.Error;
+ }
+
+ #region Deserialize
+ /// <summary>
+ /// Deserializes the Json structure contained by the specified <see cref="JsonReader"/>.
+ /// </summary>
+ /// <param name="reader">The <see cref="JsonReader"/> that contains the Json structure to deserialize.</param>
+ /// <returns>The <see cref="Object"/> being deserialized.</returns>
+ public object Deserialize(JsonReader reader)
+ {
+ return Deserialize(reader, null);
+ }
+
+ /// <summary>
+ /// Deserializes the Json structure contained by the specified <see cref="JsonReader"/>
+ /// into an instance of the specified type.
+ /// </summary>
+ /// <param name="reader">The type of object to create.</param>
+ /// <param name="objectType">The <see cref="Type"/> of object being deserialized.</param>
+ /// <returns>The instance of <paramref name="objectType"/> being deserialized.</returns>
+ public object Deserialize(JsonReader reader, Type objectType)
+ {
+ if (reader == null)
+ throw new ArgumentNullException("reader");
+
+ if (!reader.Read())
+ return null;
+
+ return GetObject(reader, objectType);
+ }
+
+ private JavaScriptArray PopulateJavaScriptArray(JsonReader reader)
+ {
+ JavaScriptArray jsArray = new JavaScriptArray();
+
+ while (reader.Read())
+ {
+ switch (reader.TokenType)
+ {
+ case JsonToken.EndArray:
+ return jsArray;
+ case JsonToken.Comment:
+ break;
+ default:
+ object value = GetObject(reader, null);
+
+ jsArray.Add(value);
+ break;
+ }
+ }
+
+ throw new JsonSerializationException("Unexpected end while deserializing array.");
+ }
+
+ private JavaScriptObject PopulateJavaScriptObject(JsonReader reader)
+ {
+ JavaScriptObject jsObject = new JavaScriptObject();
+
+ while (reader.Read())
+ {
+ switch (reader.TokenType)
+ {
+ case JsonToken.PropertyName:
+ string memberName = reader.Value.ToString();
+
+ // move to the value token. skip comments
+ do
+ {
+ if (!reader.Read())
+ throw new JsonSerializationException("Unexpected end while deserializing object.");
+ } while (reader.TokenType == JsonToken.Comment);
+
+ object value = GetObject(reader, null);
+
+ jsObject[memberName] = value;
+ break;
+ case JsonToken.EndObject:
+ return jsObject;
+ case JsonToken.Comment:
+ break;
+ default:
+ throw new JsonSerializationException("Unexpected token while deserializing object: " + reader.TokenType);
+ }
+ }
+
+ throw new JsonSerializationException("Unexpected end while deserializing object.");
+ }
+
+ private object GetObject(JsonReader reader, Type objectType)
+ {
+ _level++;
+
+ object value;
+ JsonConverter converter;
+
+ if (HasMatchingConverter(objectType, out converter))
+ {
+ return converter.ReadJson(reader, objectType);
+ }
+ else
+ {
+ switch (reader.TokenType)
+ {
+ // populate a typed object or generic dictionary/array
+ // depending upon whether an objectType was supplied
+ case JsonToken.StartObject:
+ value = (objectType != null) ? PopulateObject(reader, objectType) : PopulateJavaScriptObject(reader);
+ break;
+ case JsonToken.StartArray:
+ value = (objectType != null) ? PopulateList(reader, objectType) : PopulateJavaScriptArray(reader);
+ break;
+ case JsonToken.Integer:
+ case JsonToken.Float:
+ case JsonToken.String:
+ case JsonToken.Boolean:
+ case JsonToken.Date:
+ value = EnsureType(reader.Value, objectType);
+ break;
+ case JsonToken.Constructor:
+ value = reader.Value.ToString();
+ break;
+ case JsonToken.Null:
+ case JsonToken.Undefined:
+ value = null;
+ break;
+ default:
+ throw new JsonSerializationException("Unexpected token whil deserializing object: " + reader.TokenType);
+ }
+ }
+
+ _level--;
+
+ return value;
+ }
+
+ private object EnsureType(object value, Type targetType)
+ {
+ // do something about null value when the targetType is a valuetype?
+ if (value == null)
+ return null;
+
+ if (targetType == null)
+ return value;
+
+ Type valueType = value.GetType();
+
+ // type of value and type of target don't match
+ // attempt to convert value's type to target's type
+ if (valueType != targetType)
+ {
+ TypeConverter targetConverter = TypeDescriptor.GetConverter(targetType);
+
+ if (!targetConverter.CanConvertFrom(valueType))
+ {
+ if (targetConverter.CanConvertFrom(typeof(string)))
+ {
+ string valueString = TypeDescriptor.GetConverter(value).ConvertToInvariantString(value);
+
+ return targetConverter.ConvertFromInvariantString(valueString);
+ }
+
+ if (!targetType.IsAssignableFrom(valueType))
+ throw new InvalidOperationException(string.Format("Cannot convert object of type '{0}' to type '{1}'", value.GetType(), targetType));
+
+ return value;
+ }
+
+ return targetConverter.ConvertFrom(null, CultureInfo.InvariantCulture, value);
+ }
+ else
+ {
+ return value;
+ }
+ }
+
+ private MemberMappingCollection GetMemberMappings(Type objectType)
+ {
+ if (_typeMemberMappings == null)
+ _typeMemberMappings = new Dictionary<Type, MemberMappingCollection>();
+
+ MemberMappingCollection memberMappings;
+
+ if (_typeMemberMappings.TryGetValue(objectType, out memberMappings))
+ return memberMappings;
+
+ memberMappings = CreateMemberMappings(objectType);
+ _typeMemberMappings[objectType] = memberMappings;
+
+ return memberMappings;
+ }
+
+ private MemberMappingCollection CreateMemberMappings(Type objectType)
+ {
+ List<MemberInfo> members = ReflectionUtils.GetFieldsAndProperties(objectType, BindingFlags.Public | BindingFlags.Instance);
+ MemberMappingCollection memberMappings = new MemberMappingCollection();
+
+ foreach (MemberInfo member in members)
+ {
+ string mappedName;
+
+ JsonPropertyAttribute propertyAttribute = ReflectionUtils.GetAttribute<JsonPropertyAttribute>(member, true);
+ if (propertyAttribute != null)
+ mappedName = propertyAttribute.PropertyName;
+ else
+ mappedName = member.Name;
+
+ bool ignored = member.IsDefined(typeof (JsonIgnoreAttribute), true);
+ bool readable = ReflectionUtils.CanReadMemberValue(member);
+ bool writable = ReflectionUtils.CanSetMemberValue(member);
+ MemberMapping memberMapping = new MemberMapping(mappedName, member, ignored, readable, writable);
+
+ memberMappings.AddMapping(memberMapping);
+ }
+
+ return memberMappings;
+ }
+
+ private void SetObjectMember(JsonReader reader, object target, Type targetType, string memberName)
+ {
+ if (!reader.Read())
+ throw new JsonSerializationException(string.Format("Unexpected end when setting {0}'s value.", memberName));
+
+ MemberMappingCollection memberMappings = GetMemberMappings(targetType);
+ Type memberType;
+ object value;
+
+ // test if a member with memberName exists on the type
+ // otherwise test if target is a dictionary and assign value with the key if it is
+ if (memberMappings.Contains(memberName))
+ {
+ MemberMapping memberMapping = memberMappings[memberName];
+
+ if (memberMapping.Ignored)
+ return;
+
+ // ignore member if it is readonly
+ if (!memberMapping.Writable)
+ return;
+
+ // get the member's underlying type
+ memberType = ReflectionUtils.GetMemberUnderlyingType(memberMapping.Member);
+
+ value = GetObject(reader, memberType);
+
+ ReflectionUtils.SetMemberValue(memberMapping.Member, target, value);
+ }
+ else if (typeof(IDictionary).IsAssignableFrom(targetType))
+ {
+ // attempt to get the IDictionary's type
+ memberType = ReflectionUtils.GetDictionaryValueType(target.GetType());
+
+ value = GetObject(reader, memberType);
+
+ ((IDictionary)target).Add(memberName, value);
+ }
+ else
+ {
+ throw new JsonSerializationException(string.Format("Could not find member '{0}' on object of type '{1}'", memberName, targetType.GetType().Name));
+ }
+ }
+
+ private object PopulateList(JsonReader reader, Type objectType)
+ {
+ Type elementType = ReflectionUtils.GetListItemType(objectType);
+
+ IList populatedList = CollectionUtils.CreateAndPopulateList(objectType, delegate(IList list)
+ {
+ while (reader.Read())
+ {
+ switch (reader.TokenType)
+ {
+ case JsonToken.EndArray:
+ return;
+ case JsonToken.Comment:
+ break;
+ default:
+ object value = GetObject(reader, elementType);
+
+ list.Add(value);
+ break;
+ }
+ }
+
+ throw new JsonSerializationException("Unexpected end when deserializing array.");
+ });
+
+ return populatedList;
+ }
+
+ private object PopulateObject(JsonReader reader, Type objectType)
+ {
+ object newObject = Activator.CreateInstance(objectType);
+
+ while (reader.Read())
+ {
+ switch (reader.TokenType)
+ {
+ case JsonToken.PropertyName:
+ string memberName = reader.Value.ToString();
+
+ SetObjectMember(reader, newObject, objectType, memberName);
+ break;
+ case JsonToken.EndObject:
+ return newObject;
+ default:
+ throw new JsonSerializationException("Unexpected token when deserializing object: " + reader.TokenType);
+ }
+ }
+
+ throw new JsonSerializationException("Unexpected end when deserializing object.");
+ }
+ #endregion
+
+ #region Serialize
+ /// <summary>
+ /// Serializes the specified <see cref="Object"/> and writes the Json structure
+ /// to a <c>Stream</c> using the specified <see cref="TextWriter"/>.
+ /// </summary>
+ /// <param name="textWriter">The <see cref="TextWriter"/> used to write the Json structure.</param>
+ /// <param name="value">The <see cref="Object"/> to serialize.</param>
+ public void Serialize(TextWriter textWriter, object value)
+ {
+ Serialize(new JsonWriter(textWriter), value);
+ }
+
+ /// <summary>
+ /// Serializes the specified <see cref="Object"/> and writes the Json structure
+ /// to a <c>Stream</c> using the specified <see cref="JsonWriter"/>.
+ /// </summary>
+ /// <param name="jsonWriter">The <see cref="JsonWriter"/> used to write the Json structure.</param>
+ /// <param name="value">The <see cref="Object"/> to serialize.</param>
+ public void Serialize(JsonWriter jsonWriter, object value)
+ {
+ if (jsonWriter == null)
+ throw new ArgumentNullException("jsonWriter");
+
+ if (value == null)
+ throw new ArgumentNullException("value");
+
+ SerializeValue(jsonWriter, value);
+ }
+
+
+ private void SerializeValue(JsonWriter writer, object value)
+ {
+ JsonConverter converter;
+
+ if (value == null)
+ {
+ writer.WriteNull();
+ }
+ else if (HasMatchingConverter(value.GetType(), out converter))
+ {
+ converter.WriteJson(writer, value);
+ }
+ else if (value is IConvertible)
+ {
+ IConvertible convertible = value as IConvertible;
+
+ switch (convertible.GetTypeCode())
+ {
+ case TypeCode.String:
+ writer.WriteValue((string)convertible);
+ break;
+ case TypeCode.Char:
+ writer.WriteValue((char)convertible);
+ break;
+ case TypeCode.Boolean:
+ writer.WriteValue((bool)convertible);
+ break;
+ case TypeCode.SByte:
+ writer.WriteValue((sbyte)convertible);
+ break;
+ case TypeCode.Int16:
+ writer.WriteValue((short)convertible);
+ break;
+ case TypeCode.UInt16:
+ writer.WriteValue((ushort)convertible);
+ break;
+ case TypeCode.Int32:
+ writer.WriteValue((int)convertible);
+ break;
+ case TypeCode.Byte:
+ writer.WriteValue((byte)convertible);
+ break;
+ case TypeCode.UInt32:
+ writer.WriteValue((uint)convertible);
+ break;
+ case TypeCode.Int64:
+ writer.WriteValue((long)convertible);
+ break;
+ case TypeCode.UInt64:
+ writer.WriteValue((ulong)convertible);
+ break;
+ case TypeCode.Single:
+ writer.WriteValue((float)convertible);
+ break;
+ case TypeCode.Double:
+ writer.WriteValue((double)convertible);
+ break;
+ case TypeCode.DateTime:
+ writer.WriteValue((DateTime)convertible);
+ break;
+ case TypeCode.Decimal:
+ writer.WriteValue((decimal)convertible);
+ break;
+ default:
+ SerializeObject(writer, value);
+ break;
+ }
+ }
+ else if (value is IList)
+ {
+ SerializeList(writer, (IList)value);
+ }
+ else if (value is IDictionary)
+ {
+ SerializeDictionary(writer, (IDictionary)value);
+ }
+ else if (value is ICollection)
+ {
+ SerializeCollection(writer, (ICollection)value);
+ }
+ else if (value is Identifier)
+ {
+ writer.WriteRaw(value.ToString());
+ }
+ else
+ {
+ SerializeObject(writer, value);
+ }
+ }
+
+ private bool HasMatchingConverter(Type type, out JsonConverter matchingConverter)
+ {
+ if (_converters != null)
+ {
+ for (int i = 0; i < _converters.Count; i++)
+ {
+ JsonConverter converter = _converters[i];
+
+ if (converter.CanConvert(type))
+ {
+ matchingConverter = converter;
+ return true;
+ }
+ }
+ }
+
+ matchingConverter = null;
+ return false;
+ }
+
+ private void WriteMemberInfoProperty(JsonWriter writer, object value, MemberInfo member, string propertyName)
+ {
+ if (!ReflectionUtils.IsIndexedProperty(member))
+ {
+ object memberValue = ReflectionUtils.GetMemberValue(member, value);
+
+ if (writer.SerializeStack.IndexOf(memberValue) != -1)
+ {
+ switch (_referenceLoopHandling)
+ {
+ case ReferenceLoopHandling.Error:
+ throw new JsonSerializationException("Self referencing loop");
+ case ReferenceLoopHandling.Ignore:
+ // return from method
+ return;
+ case ReferenceLoopHandling.Serialize:
+ // continue
+ break;
+ default:
+ throw new InvalidOperationException(string.Format("Unexpected ReferenceLoopHandling value: '{0}'", _referenceLoopHandling));
+ }
+ }
+
+ writer.WritePropertyName(propertyName ?? member.Name);
+ SerializeValue(writer, memberValue);
+ }
+ }
+
+ private void SerializeObject(JsonWriter writer, object value)
+ {
+ Type objectType = value.GetType();
+
+ TypeConverter converter = TypeDescriptor.GetConverter(objectType);
+
+ // use the objectType's TypeConverter if it has one and can convert to a string
+ if (converter != null && !(converter is ComponentConverter) && converter.GetType() != typeof(TypeConverter))
+ {
+ if (converter.CanConvertTo(typeof(string)))
+ {
+ writer.WriteValue(converter.ConvertToInvariantString(value));
+ return;
+ }
+ }
+
+ writer.SerializeStack.Add(value);
+
+ writer.WriteStartObject();
+
+ MemberMappingCollection memberMappings = GetMemberMappings(objectType);
+
+ foreach (MemberMapping memberMapping in memberMappings)
+ {
+ if (!memberMapping.Ignored && memberMapping.Readable)
+ WriteMemberInfoProperty(writer, value, memberMapping.Member, memberMapping.MappingName);
+ }
+
+ writer.WriteEndObject();
+
+ writer.SerializeStack.Remove(value);
+ }
+
+ private void SerializeCollection(JsonWriter writer, ICollection values)
+ {
+ object[] collectionValues = new object[values.Count];
+ values.CopyTo(collectionValues, 0);
+
+ SerializeList(writer, collectionValues);
+ }
+
+ private void SerializeList(JsonWriter writer, IList values)
+ {
+ writer.WriteStartArray();
+
+ for (int i = 0; i < values.Count; i++)
+ {
+ SerializeValue(writer, values[i]);
+ }
+
+ writer.WriteEndArray();
+ }
+
+ private void SerializeDictionary(JsonWriter writer, IDictionary values)
+ {
+ writer.WriteStartObject();
+
+ foreach (DictionaryEntry entry in values)
+ {
+ writer.WritePropertyName(entry.Key.ToString());
+ SerializeValue(writer, entry.Value);
+ }
+
+ writer.WriteEndObject();
+ }
+ #endregion
+ }
+}
diff --git a/Src/Newtonsoft.Json/JsonToken.cs b/Src/Newtonsoft.Json/JsonToken.cs new file mode 100644 index 0000000..e64d875 --- /dev/null +++ b/Src/Newtonsoft.Json/JsonToken.cs @@ -0,0 +1,98 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json
+{
+ /// <summary>
+ /// Specifies the type of Json token.
+ /// </summary>
+ public enum JsonToken
+ {
+ /// <summary>
+ /// This is returned by the <see cref="JsonReader"/> if a <see cref="JsonReader.Read"/> method has not been called.
+ /// </summary>
+ None,
+ /// <summary>
+ /// An object start token.
+ /// </summary>
+ StartObject,
+ /// <summary>
+ /// An array start token.
+ /// </summary>
+ StartArray,
+ /// <summary>
+ /// An object property name.
+ /// </summary>
+ PropertyName,
+ /// <summary>
+ /// A comment.
+ /// </summary>
+ Comment,
+ /// <summary>
+ /// An interger.
+ /// </summary>
+ Integer,
+ /// <summary>
+ /// A float.
+ /// </summary>
+ Float,
+ /// <summary>
+ /// A string.
+ /// </summary>
+ String,
+ /// <summary>
+ /// A boolean.
+ /// </summary>
+ Boolean,
+ /// <summary>
+ /// A null token.
+ /// </summary>
+ Null,
+ /// <summary>
+ /// An undefined token.
+ /// </summary>
+ Undefined,
+ /// <summary>
+ /// An object end token.
+ /// </summary>
+ EndObject,
+ /// <summary>
+ /// An array end token.
+ /// </summary>
+ EndArray,
+ /// <summary>
+ /// A JavaScript object constructor.
+ /// </summary>
+ Constructor,
+ /// <summary>
+ /// A Date.
+ /// </summary>
+ Date
+ }
+}
diff --git a/Src/Newtonsoft.Json/JsonWriter.cs b/Src/Newtonsoft.Json/JsonWriter.cs new file mode 100644 index 0000000..499aa72 --- /dev/null +++ b/Src/Newtonsoft.Json/JsonWriter.cs @@ -0,0 +1,732 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Xml;
+using Newtonsoft.Json.Utilities;
+
+namespace Newtonsoft.Json
+{
+ internal enum JsonType
+ {
+ Object,
+ Array,
+ None
+ }
+
+ /// <summary>
+ /// Specifies the state of the <see cref="JsonWriter"/>.
+ /// </summary>
+ public enum WriteState
+ {
+ /// <summary>
+ /// An exception has been thrown, which has left the <see cref="JsonWriter"/> in an invalid state.
+ /// You may call the <see cref="JsonWriter.Close"/> method to put the <see cref="JsonWriter"/> in the <c>Closed</c> state.
+ /// Any other <see cref="JsonWriter"/> method calls results in an <see cref="InvalidOperationException"/> being thrown.
+ /// </summary>
+ Error,
+ /// <summary>
+ /// The <see cref="JsonWriter.Close"/> method has been called.
+ /// </summary>
+ Closed,
+ /// <summary>
+ /// An object is being written.
+ /// </summary>
+ Object,
+ /// <summary>
+ /// A array is being written.
+ /// </summary>
+ Array,
+ /// <summary>
+ /// A property is being written.
+ /// </summary>
+ Property,
+ /// <summary>
+ /// A write method has not been called.
+ /// </summary>
+ Start
+ }
+
+ /// <summary>
+ /// Specifies formatting options for the <see cref="JsonWriter"/>.
+ /// </summary>
+ public enum Formatting
+ {
+ /// <summary>
+ /// No special formatting is applied. This is the default.
+ /// </summary>
+ None,
+ /// <summary>
+ /// Causes child objects to be indented according to the <see cref="JsonWriter.Indentation"/> and <see cref="JsonWriter.IndentChar"/> settings.
+ /// </summary>
+ Indented
+ }
+
+ /// <summary>
+ /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data.
+ /// </summary>
+ public class JsonWriter : IDisposable
+ {
+ private enum State
+ {
+ Start,
+ Property,
+ ObjectStart,
+ Object,
+ ArrayStart,
+ Array,
+ Closed,
+ Error
+ }
+
+ // array that gives a new state based on the current state an the token being written
+ private static readonly State[,] stateArray = {
+ // Start PropertyName ObjectStart Object ArrayStart Array Closed Error
+ //
+ /* None */{ State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error },
+ /* StartObject */{ State.ObjectStart, State.ObjectStart, State.Error, State.Error, State.ObjectStart, State.ObjectStart, State.Error, State.Error },
+ /* StartArray */{ State.ArrayStart, State.ArrayStart, State.Error, State.Error, State.ArrayStart, State.ArrayStart, State.Error, State.Error },
+ /* StartProperty */{ State.Error, State.Error, State.Property, State.Property, State.Error, State.Error, State.Error, State.Error },
+ /* Comment */{ State.Error, State.Property, State.ObjectStart, State.Object, State.ArrayStart, State.Array, State.Error, State.Error },
+ /* Value */{ State.Error, State.Object, State.Error, State.Error, State.Array, State.Array, State.Error, State.Error },
+ };
+
+ private int _top;
+ private List<JsonType> _stack;
+ private List<object> _serializeStack;
+ private TextWriter _writer;
+ private Formatting _formatting;
+ private char _indentChar;
+ private int _indentation;
+ private char _quoteChar;
+ private bool _quoteName;
+ private State _currentState;
+
+ internal List<object> SerializeStack
+ {
+ get
+ {
+ if (_serializeStack == null)
+ _serializeStack = new List<object>();
+
+ return _serializeStack;
+ }
+ }
+
+ /// <summary>
+ /// Gets the state of the writer.
+ /// </summary>
+ public WriteState WriteState
+ {
+ get
+ {
+ switch (_currentState)
+ {
+ case State.Error:
+ return WriteState.Error;
+ case State.Closed:
+ return WriteState.Closed;
+ case State.Object:
+ case State.ObjectStart:
+ return WriteState.Object;
+ case State.Array:
+ case State.ArrayStart:
+ return WriteState.Array;
+ case State.Property:
+ return WriteState.Property;
+ case State.Start:
+ return WriteState.Start;
+ default:
+ throw new JsonWriterException("Invalid state: " + _currentState);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Indicates how the output is formatted.
+ /// </summary>
+ public Formatting Formatting
+ {
+ get { return _formatting; }
+ set { _formatting = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets how many IndentChars to write for each level in the hierarchy when <paramref name="Formatting"/> is set to <c>Formatting.Indented</c>.
+ /// </summary>
+ public int Indentation
+ {
+ get { return _indentation; }
+ set
+ {
+ if (value < 0)
+ throw new ArgumentException("Indentation value must be greater than 0.");
+
+ _indentation = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets which character to use to quote attribute values.
+ /// </summary>
+ public char QuoteChar
+ {
+ get { return _quoteChar; }
+ set
+ {
+ if (value != '"' && value != '\'')
+ throw new ArgumentException(@"Invalid JavaScript string quote character. Valid quote characters are ' and "".");
+
+ _quoteChar = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets which character to use for indenting when <paramref name="Formatting"/> is set to <c>Formatting.Indented</c>.
+ /// </summary>
+ public char IndentChar
+ {
+ get { return _indentChar; }
+ set { _indentChar = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether object names will be surrounded with quotes.
+ /// </summary>
+ public bool QuoteName
+ {
+ get { return _quoteName; }
+ set { _quoteName = value; }
+ }
+
+ /// <summary>
+ /// Creates an instance of the <c>JsonWriter</c> class using the specified <see cref="TextWriter"/>.
+ /// </summary>
+ /// <param name="textWriter">The <c>TextWriter</c> to write to.</param>
+ public JsonWriter(TextWriter textWriter)
+ {
+ if (textWriter == null)
+ throw new ArgumentNullException("textWriter");
+
+ _writer = textWriter;
+ _quoteChar = '"';
+ _quoteName = true;
+ _indentChar = ' ';
+ _indentation = 2;
+ _formatting = Formatting.None;
+ _stack = new List<JsonType>(1);
+ _stack.Add(JsonType.None);
+ _currentState = State.Start;
+ }
+
+ private void Push(JsonType value)
+ {
+ _top++;
+ if (_stack.Count <= _top)
+ _stack.Add(value);
+ else
+ _stack[_top] = value;
+ }
+
+ private JsonType Pop()
+ {
+ JsonType value = Peek();
+ _top--;
+
+ return value;
+ }
+
+ private JsonType Peek()
+ {
+ return _stack[_top];
+ }
+
+ /// <summary>
+ /// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.
+ /// </summary>
+ public void Flush()
+ {
+ _writer.Flush();
+ }
+
+ /// <summary>
+ /// Closes this stream and the underlying stream.
+ /// </summary>
+ public void Close()
+ {
+ AutoCompleteAll();
+
+ _writer.Close();
+ }
+
+ /// <summary>
+ /// Writes the beginning of a Json object.
+ /// </summary>
+ public void WriteStartObject()
+ {
+ AutoComplete(JsonToken.StartObject);
+
+ Push(JsonType.Object);
+
+ _writer.Write("{");
+ }
+
+ /// <summary>
+ /// Writes the end of a Json object.
+ /// </summary>
+ public void WriteEndObject()
+ {
+ AutoCompleteClose(JsonToken.EndObject);
+ }
+
+ /// <summary>
+ /// Writes the beginning of a Json array.
+ /// </summary>
+ public void WriteStartArray()
+ {
+ AutoComplete(JsonToken.StartArray);
+ Push(JsonType.Array);
+ _writer.Write("[");
+ }
+
+ /// <summary>
+ /// Writes the end of an array.
+ /// </summary>
+ public void WriteEndArray()
+ {
+ AutoCompleteClose(JsonToken.EndArray);
+ }
+
+ /// <summary>
+ /// Writes the property name of a name/value pair on a Json object.
+ /// </summary>
+ /// <param name="name"></param>
+ public void WritePropertyName(string name)
+ {
+ //_objectStack.Push(new JsonObjectInfo(JsonType.Property));
+ AutoComplete(JsonToken.PropertyName);
+
+ if (_quoteName)
+ _writer.Write(_quoteChar);
+
+ _writer.Write(name);
+
+ if (_quoteName)
+ _writer.Write(_quoteChar);
+
+ _writer.Write(':');
+ }
+
+ /// <summary>
+ /// Writes the end of the current Json object or array.
+ /// </summary>
+ public void WriteEnd()
+ {
+ WriteEnd(Peek());
+ }
+
+ private void WriteEnd(JsonType type)
+ {
+ switch (type)
+ {
+ case JsonType.Object:
+ WriteEndObject();
+ break;
+ case JsonType.Array:
+ WriteEndArray();
+ break;
+ default:
+ throw new JsonWriterException("Unexpected type when writing end: " + type);
+ }
+ }
+
+ private void AutoCompleteAll()
+ {
+ while (_top > 0)
+ {
+ WriteEnd();
+ }
+ }
+
+ private JsonType GetTypeForCloseToken(JsonToken token)
+ {
+ switch (token)
+ {
+ case JsonToken.EndObject:
+ return JsonType.Object;
+ case JsonToken.EndArray:
+ return JsonType.Array;
+ default:
+ throw new JsonWriterException("No type for token: " + token);
+ }
+ }
+
+ private JsonToken GetCloseTokenForType(JsonType type)
+ {
+ switch (type)
+ {
+ case JsonType.Object:
+ return JsonToken.EndObject;
+ case JsonType.Array:
+ return JsonToken.EndArray;
+ default:
+ throw new JsonWriterException("No close token for type: " + type);
+ }
+ }
+
+ private void AutoCompleteClose(JsonToken tokenBeingClosed)
+ {
+ // write closing symbol and calculate new state
+
+ int levelsToComplete = 0;
+
+ for (int i = 0; i < _top; i++)
+ {
+ int currentLevel = _top - i;
+
+ if (_stack[currentLevel] == GetTypeForCloseToken(tokenBeingClosed))
+ {
+ levelsToComplete = i + 1;
+ break;
+ }
+ }
+
+ if (levelsToComplete == 0)
+ throw new JsonWriterException("No token to close.");
+
+ for (int i = 0; i < levelsToComplete; i++)
+ {
+ JsonToken token = GetCloseTokenForType(Pop());
+
+ if (_currentState != State.ObjectStart && _currentState != State.ArrayStart)
+ WriteIndent();
+
+ switch (token)
+ {
+ case JsonToken.EndObject:
+ _writer.Write("}");
+ break;
+ case JsonToken.EndArray:
+ _writer.Write("]");
+ break;
+ default:
+ throw new JsonWriterException("Invalid JsonToken: " + token);
+ }
+ }
+
+ JsonType currentLevelType = Peek();
+
+ switch (currentLevelType)
+ {
+ case JsonType.Object:
+ _currentState = State.Object;
+ break;
+ case JsonType.Array:
+ _currentState = State.Array;
+ break;
+ case JsonType.None:
+ _currentState = State.Start;
+ break;
+ default:
+ throw new JsonWriterException("Unknown JsonType: " + currentLevelType);
+ }
+ }
+
+ private void WriteIndent()
+ {
+ if (_formatting == Formatting.Indented)
+ {
+ _writer.Write(Environment.NewLine);
+ // for each level of object...
+ for (int i = 0; i < _top; i++)
+ {
+ // ...write the indent char the specified number of times
+ for (int j = 0; j < _indentation; j++)
+ {
+ _writer.Write(_indentChar);
+ }
+ }
+ }
+ }
+
+ private void AutoComplete(JsonToken tokenBeingWritten)
+ {
+ int token;
+
+ switch (tokenBeingWritten)
+ {
+ default:
+ token = (int)tokenBeingWritten;
+ break;
+ case JsonToken.Integer:
+ case JsonToken.Float:
+ case JsonToken.String:
+ case JsonToken.Boolean:
+ case JsonToken.Null:
+ case JsonToken.Undefined:
+ case JsonToken.Date:
+ // a value is being written
+ token = 5;
+ break;
+ }
+
+ // gets new state based on the current state and what is being written
+ State newState = stateArray[token, (int)_currentState];
+
+ if (newState == State.Error)
+ throw new JsonWriterException(string.Format("Token {0} in state {1} would result in an invalid JavaScript object.", tokenBeingWritten.ToString(), _currentState.ToString()));
+
+ if ((_currentState == State.Object || _currentState == State.Array) && tokenBeingWritten != JsonToken.Comment)
+ {
+ _writer.Write(',');
+ }
+ else if (_currentState == State.Property)
+ {
+ if (_formatting == Formatting.Indented)
+ _writer.Write(' ');
+ }
+
+ if (tokenBeingWritten == JsonToken.PropertyName ||
+ (WriteState == WriteState.Array))
+ {
+ WriteIndent();
+ }
+
+ _currentState = newState;
+ }
+
+ private void WriteValueInternal(string value, JsonToken token)
+ {
+ AutoComplete(token);
+
+ _writer.Write(value);
+ }
+
+ #region WriteValue methods
+ /// <summary>
+ /// Writes a null value.
+ /// </summary>
+ public void WriteNull()
+ {
+ WriteValueInternal(JavaScriptConvert.Null, JsonToken.Null);
+ }
+
+ /// <summary>
+ /// Writes an undefined value.
+ /// </summary>
+ public void WriteUndefined()
+ {
+ WriteValueInternal(JavaScriptConvert.Undefined, JsonToken.Undefined);
+ }
+
+ /// <summary>
+ /// Writes raw JavaScript manually.
+ /// </summary>
+ /// <param name="javaScript">The raw JavaScript to write.</param>
+ public void WriteRaw(string javaScript)
+ {
+ // hack. some 'raw' or 'other' token perhaps?
+ WriteValueInternal(javaScript, JsonToken.Undefined);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="String"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="String"/> value to write.</param>
+ public void WriteValue(string value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value, _quoteChar), JsonToken.String);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="Int32"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="Int32"/> value to write.</param>
+ public void WriteValue(int value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="UInt32"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="UInt32"/> value to write.</param>
+ public void WriteValue(uint value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="Int64"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="Int64"/> value to write.</param>
+ public void WriteValue(long value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="UInt64"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="UInt64"/> value to write.</param>
+ public void WriteValue(ulong value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="Single"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="Single"/> value to write.</param>
+ public void WriteValue(float value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="Double"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="Double"/> value to write.</param>
+ public void WriteValue(double value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="Boolean"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="Boolean"/> value to write.</param>
+ public void WriteValue(bool value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Boolean);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="Int16"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="Int16"/> value to write.</param>
+ public void WriteValue(short value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="UInt16"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="UInt16"/> value to write.</param>
+ public void WriteValue(ushort value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="Char"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="Char"/> value to write.</param>
+ public void WriteValue(char value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="Byte"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="Byte"/> value to write.</param>
+ public void WriteValue(byte value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="SByte"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="SByte"/> value to write.</param>
+ public void WriteValue(sbyte value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="Decimal"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="Decimal"/> value to write.</param>
+ public void WriteValue(decimal value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float);
+ }
+
+ /// <summary>
+ /// Writes a <see cref="DateTime"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="DateTime"/> value to write.</param>
+ public void WriteValue(DateTime value)
+ {
+ WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Date);
+ }
+ #endregion
+
+ /// <summary>
+ /// Writes out a comment <code>/*...*/</code> containing the specified text.
+ /// </summary>
+ /// <param name="text">Text to place inside the comment.</param>
+ public void WriteComment(string text)
+ {
+ AutoComplete(JsonToken.Comment);
+
+ _writer.Write("/*");
+ _writer.Write(text);
+ _writer.Write("*/");
+ }
+
+ /// <summary>
+ /// Writes out the given white space.
+ /// </summary>
+ /// <param name="ws">The string of white space characters.</param>
+ public void WriteWhitespace(string ws)
+ {
+ if (ws != null)
+ {
+ if (!StringUtils.IsWhiteSpace(ws))
+ throw new JsonWriterException("Only white space characters should be used.");
+
+ _writer.Write(ws);
+ }
+ }
+
+ void IDisposable.Dispose()
+ {
+ Dispose(true);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (WriteState != WriteState.Closed)
+ Close();
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/JsonWriterException.cs b/Src/Newtonsoft.Json/JsonWriterException.cs new file mode 100644 index 0000000..bc43cd3 --- /dev/null +++ b/Src/Newtonsoft.Json/JsonWriterException.cs @@ -0,0 +1,65 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json
+{
+ /// <summary>
+ /// The exception thrown when an error occurs while reading Json text.
+ /// </summary>
+ public class JsonWriterException : Exception
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JsonWriterException"/> class.
+ /// </summary>
+ public JsonWriterException()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JsonWriterException"/> class
+ /// with a specified error message.
+ /// </summary>
+ /// <param name="message">The error message that explains the reason for the exception.</param>
+ public JsonWriterException(string message)
+ : base(message)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JsonWriterException"/> class
+ /// with a specified error message and a reference to the inner exception that is the cause of this exception.
+ /// </summary>
+ /// <param name="message">The error message that explains the reason for the exception.</param>
+ /// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
+ public JsonWriterException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/MemberMapping.cs b/Src/Newtonsoft.Json/MemberMapping.cs new file mode 100644 index 0000000..910f429 --- /dev/null +++ b/Src/Newtonsoft.Json/MemberMapping.cs @@ -0,0 +1,50 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Reflection;
+
+namespace Newtonsoft.Json
+{
+ internal struct MemberMapping
+ {
+ private readonly string _mappingName;
+ private readonly MemberInfo _member;
+ private readonly bool _ignored;
+ private readonly bool _readable;
+ private readonly bool _writable;
+
+ public MemberMapping(string mappingName, MemberInfo member, bool ignored, bool readable, bool writable)
+ {
+ _mappingName = mappingName;
+ _member = member;
+ _ignored = ignored;
+ _readable = readable;
+ _writable = writable;
+ }
+
+ public string MappingName
+ {
+ get { return _mappingName; }
+ }
+
+ public MemberInfo Member
+ {
+ get { return _member; }
+ }
+
+ public bool Ignored
+ {
+ get { return _ignored; }
+ }
+
+ public bool Readable
+ {
+ get { return _readable; }
+ }
+
+ public bool Writable
+ {
+ get { return _writable; }
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/MemberMappingCollection.cs b/Src/Newtonsoft.Json/MemberMappingCollection.cs new file mode 100644 index 0000000..bb00286 --- /dev/null +++ b/Src/Newtonsoft.Json/MemberMappingCollection.cs @@ -0,0 +1,42 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Collections.ObjectModel;
+
+namespace Newtonsoft.Json
+{
+ internal class MemberMappingCollection : KeyedCollection<string, MemberMapping>
+ {
+ protected override string GetKeyForItem(MemberMapping item)
+ {
+ return item.MappingName;
+ }
+
+ public void AddMapping(MemberMapping memberMapping)
+ {
+ if (Contains(memberMapping.MappingName))
+ {
+ // don't overwrite existing mapping with ignored mapping
+ if (memberMapping.Ignored)
+ return;
+
+ MemberMapping existingMemberMapping = this[memberMapping.MappingName];
+
+ if (!existingMemberMapping.Ignored)
+ {
+ throw new JsonSerializationException(
+ string.Format(
+ "A member with the name '{0}' already exists on {1}. Use the JsonPropertyAttribute to specify another name.",
+ memberMapping.MappingName, memberMapping.Member.DeclaringType));
+ }
+ else
+ {
+ // remove ignored mapping so it can be replaced in collection
+ Remove(existingMemberMapping);
+ }
+ }
+
+ Add(memberMapping);
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj new file mode 100644 index 0000000..f5335ba --- /dev/null +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj @@ -0,0 +1,84 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Newtonsoft.Json</RootNamespace>
+ <AssemblyName>Newtonsoft.Json</AssemblyName>
+ <SignAssembly>false</SignAssembly>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <SccProjectName>
+ </SccProjectName>
+ <SccLocalPath>
+ </SccLocalPath>
+ <SccAuxPath>
+ </SccAuxPath>
+ <SccProvider>
+ </SccProvider>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <DocumentationFile>bin\Debug\Newtonsoft.Json.XML</DocumentationFile>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <DocumentationFile>bin\Release\Newtonsoft.Json.XML</DocumentationFile>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Converters\AspNetAjaxDateTimeConverter.cs" />
+ <Compile Include="Converters\XmlNodeConverter.cs" />
+ <Compile Include="Converters\HtmlColorConverter.cs" />
+ <Compile Include="JavaScriptParameters.cs" />
+ <Compile Include="JavaScriptConstructor.cs" />
+ <Compile Include="JsonPropertyAttribute.cs" />
+ <Compile Include="JsonIgnoreAttribute.cs" />
+ <Compile Include="JsonWriterException.cs" />
+ <Compile Include="JsonReaderException.cs" />
+ <Compile Include="Identifier.cs" />
+ <Compile Include="JavaScriptArray.cs" />
+ <Compile Include="JavaScriptObject.cs" />
+ <Compile Include="JsonConverter.cs" />
+ <Compile Include="JsonConverterCollection.cs" />
+ <Compile Include="JsonReader.cs" />
+ <Compile Include="JavaScriptConvert.cs" />
+ <Compile Include="JsonSerializationException.cs" />
+ <Compile Include="JsonSerializer.cs" />
+ <Compile Include="MemberMapping.cs" />
+ <Compile Include="MemberMappingCollection.cs" />
+ <Compile Include="Utilities\JavaScriptUtils.cs" />
+ <Compile Include="JsonToken.cs" />
+ <Compile Include="JsonWriter.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="StringBuffer.cs" />
+ <Compile Include="Utilities\CollectionUtils.cs" />
+ <Compile Include="Utilities\MathUtils.cs" />
+ <Compile Include="Utilities\MiscellaneousUtils.cs" />
+ <Compile Include="Utilities\ReflectionUtils.cs" />
+ <Compile Include="Utilities\StringUtils.cs" />
+ <Compile Include="Utilities\ValidationUtils.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e17ba8f --- /dev/null +++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs @@ -0,0 +1,57 @@ +#region License
+// Copyright 2006 James Newton-King
+// http://www.newtonsoft.com
+//
+// This work is licensed under the Creative Commons Attribution 2.5 License
+// http://creativecommons.org/licenses/by/2.5/
+//
+// You are free:
+// * to copy, distribute, display, and perform the work
+// * to make derivative works
+// * to make commercial use of the work
+//
+// Under the following conditions:
+// * You must attribute the work in the manner specified by the author or licensor:
+// - If you find this component useful a link to http://www.newtonsoft.com would be appreciated.
+// * For any reuse or distribution, you must make clear to others the license terms of this work.
+// * Any of these conditions can be waived if you get permission from the copyright holder.
+#endregion
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Security;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Newtonsoft Json.NET")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Newtonsoft")]
+[assembly: AssemblyProduct("Newtonsoft Json.NET")]
+[assembly: AssemblyCopyright("Copyright © Newtonsoft 2006")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: AllowPartiallyTrustedCallers]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM componenets. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("9ca358aa-317b-4925-8ada-4a29e943a363")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.3.0.0")]
+[assembly: AssemblyFileVersion("1.3.0.0")]
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/StringBuffer.cs b/Src/Newtonsoft.Json/StringBuffer.cs new file mode 100644 index 0000000..0365799 --- /dev/null +++ b/Src/Newtonsoft.Json/StringBuffer.cs @@ -0,0 +1,90 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json
+{
+ /// <summary>
+ /// Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer.
+ /// </summary>
+ internal class StringBuffer
+ {
+ private char[] _buffer;
+ private int _position;
+
+ private static char[] _emptyBuffer = new char[0];
+
+ public int Position
+ {
+ get { return _position; }
+ set { _position = value; }
+ }
+
+ public StringBuffer()
+ {
+ _buffer = _emptyBuffer;
+ }
+
+ public StringBuffer(int initalSize)
+ {
+ _buffer = new char[initalSize];
+ }
+
+ public void Append(char value)
+ {
+ // test if the buffer array is large enough to take the value
+ if (_position + 1 > _buffer.Length)
+ {
+ EnsureSize(1);
+ }
+
+ // set value and increment poisition
+ _buffer[_position++] = value;
+ }
+
+ public void Clear()
+ {
+ _buffer = _emptyBuffer;
+ _position = 0;
+ }
+
+ private void EnsureSize(int appendLength)
+ {
+ char[] newBuffer = new char[_position + appendLength * 2];
+
+ Array.Copy(_buffer, newBuffer, _position);
+
+ _buffer = newBuffer;
+ }
+
+ public override string ToString()
+ {
+ return new string(_buffer, 0, _position);
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/Utilities/CollectionUtils.cs b/Src/Newtonsoft.Json/Utilities/CollectionUtils.cs new file mode 100644 index 0000000..6616a3d --- /dev/null +++ b/Src/Newtonsoft.Json/Utilities/CollectionUtils.cs @@ -0,0 +1,419 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Reflection;
+using System.Text;
+using System.Collections;
+
+namespace Newtonsoft.Json.Utilities
+{
+ internal static class CollectionUtils
+ {
+ public static List<T> CreateList<T>(params T[] values)
+ {
+ return new List<T>(values);
+ }
+
+ /// <summary>
+ /// Determines whether the collection is null or empty.
+ /// </summary>
+ /// <param name="collection">The collection.</param>
+ /// <returns>
+ /// <c>true</c> if the collection is null or empty; otherwise, <c>false</c>.
+ /// </returns>
+ public static bool IsNullOrEmpty(ICollection collection)
+ {
+ if (collection != null)
+ {
+ return (collection.Count == 0);
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// Determines whether the collection is null or empty.
+ /// </summary>
+ /// <param name="collection">The collection.</param>
+ /// <returns>
+ /// <c>true</c> if the collection is null or empty; otherwise, <c>false</c>.
+ /// </returns>
+ public static bool IsNullOrEmpty<T>(ICollection<T> collection)
+ {
+ if (collection != null)
+ {
+ return (collection.Count == 0);
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// Determines whether the collection is null, empty or its contents are uninitialized values.
+ /// </summary>
+ /// <param name="list">The list.</param>
+ /// <returns>
+ /// <c>true</c> if the collection is null or empty or its contents are uninitialized values; otherwise, <c>false</c>.
+ /// </returns>
+ public static bool IsNullOrEmptyOrDefault<T>(IList<T> list)
+ {
+ if (IsNullOrEmpty<T>(list))
+ return true;
+
+ return ReflectionUtils.ItemsUnitializedValue<T>(list);
+ }
+
+ /// <summary>
+ /// Makes a slice of the specified list in between the start and end indexes.
+ /// </summary>
+ /// <param name="list">The list.</param>
+ /// <param name="start">The start index.</param>
+ /// <param name="end">The end index.</param>
+ /// <returns>A slice of the list.</returns>
+ public static IList<T> Slice<T>(IList<T> list, int? start, int? end)
+ {
+ return Slice<T>(list, start, end, null);
+ }
+
+ /// <summary>
+ /// Makes a slice of the specified list in between the start and end indexes,
+ /// getting every so many items based upon the step.
+ /// </summary>
+ /// <param name="list">The list.</param>
+ /// <param name="start">The start index.</param>
+ /// <param name="end">The end index.</param>
+ /// <param name="step">The step.</param>
+ /// <returns>A slice of the list.</returns>
+ public static IList<T> Slice<T>(IList<T> list, int? start, int? end, int? step)
+ {
+ if (list == null)
+ throw new ArgumentNullException("list");
+
+ if (step == 0)
+ throw new ArgumentException("Step cannot be zero.", "step");
+
+ List<T> slicedList = new List<T>();
+
+ // nothing to slice
+ if (list.Count == 0)
+ return slicedList;
+
+ // set defaults for null arguments
+ int s = step ?? 1;
+ int startIndex = start ?? 0;
+ int endIndex = end ?? list.Count;
+
+ // start from the end of the list if start is negitive
+ startIndex = (startIndex < 0) ? list.Count + startIndex : startIndex;
+
+ // end from the start of the list if end is negitive
+ endIndex = (endIndex < 0) ? list.Count + endIndex : endIndex;
+
+ // ensure indexes keep within collection bounds
+ startIndex = Math.Max(startIndex, 0);
+ endIndex = Math.Min(endIndex, list.Count - 1);
+
+ // loop between start and end indexes, incrementing by the step
+ for (int i = startIndex; i < endIndex; i += s)
+ {
+ slicedList.Add(list[i]);
+ }
+
+ return slicedList;
+ }
+
+
+ /// <summary>
+ /// Group the collection using a function which returns the key.
+ /// </summary>
+ /// <param name="source">The source collection to group.</param>
+ /// <param name="keySelector">The key selector.</param>
+ /// <returns>A Dictionary with each key relating to a list of objects in a list grouped under it.</returns>
+ public static Dictionary<K, List<V>> GroupBy<K, V>(ICollection<V> source, Func<V, K> keySelector)
+ {
+ if (keySelector == null)
+ throw new ArgumentNullException("keySelector");
+
+ Dictionary<K, List<V>> groupedValues = new Dictionary<K, List<V>>();
+
+ foreach (V value in source)
+ {
+ // using delegate to get the value's key
+ K key = keySelector(value);
+ List<V> groupedValueList;
+
+ // add a list for grouped values if the key is not already in Dictionary
+ if (!groupedValues.TryGetValue(key, out groupedValueList))
+ {
+ groupedValueList = new List<V>();
+ groupedValues.Add(key, groupedValueList);
+ }
+
+ groupedValueList.Add(value);
+ }
+
+ return groupedValues;
+ }
+
+ /// <summary>
+ /// Adds the elements of the specified collection to the specified generic IList.
+ /// </summary>
+ /// <param name="initial">The list to add to.</param>
+ /// <param name="collection">The collection of elements to add.</param>
+ public static void AddRange<T>(IList<T> initial, IEnumerable<T> collection)
+ {
+ if (initial == null)
+ throw new ArgumentNullException("initial");
+
+ if (collection == null)
+ return;
+
+ foreach (T value in collection)
+ {
+ initial.Add(value);
+ }
+ }
+
+ public static List<T> Distinct<T>(List<T> collection)
+ {
+ List<T> distinctList = new List<T>();
+
+ foreach (T value in collection)
+ {
+ if (!distinctList.Contains(value))
+ distinctList.Add(value);
+ }
+
+ return distinctList;
+ }
+
+ public static List<List<T>> Flatten<T>(params IList<T>[] lists)
+ {
+ List<List<T>> flattened = new List<List<T>>();
+ Dictionary<int, T> currentList = new Dictionary<int, T>();
+
+ Recurse<T>(new List<IList<T>>(lists), 0, currentList, flattened);
+
+ return flattened;
+ }
+
+ private static void Recurse<T>(IList<IList<T>> global, int current, Dictionary<int, T> currentSet, List<List<T>> flattenedResult)
+ {
+ IList<T> currentArray = global[current];
+
+ for (int i = 0; i < currentArray.Count; i++)
+ {
+ currentSet[current] = currentArray[i];
+
+ if (current == global.Count - 1)
+ {
+ List<T> items = new List<T>();
+
+ for (int k = 0; k < currentSet.Count; k++)
+ {
+ items.Add(currentSet[k]);
+ }
+
+ flattenedResult.Add(items);
+ }
+ else
+ {
+ Recurse(global, current + 1, currentSet, flattenedResult);
+ }
+ }
+ }
+
+ public static List<T> CreateList<T>(ICollection collection)
+ {
+ if (collection == null)
+ throw new ArgumentNullException("collection");
+
+ T[] array = new T[collection.Count];
+ collection.CopyTo(array, 0);
+
+ return new List<T>(array);
+ }
+
+ public static bool ListEquals<T>(IList<T> a, IList<T> b)
+ {
+ if (a == null || b == null)
+ return (a == null && b == null);
+
+ if (a.Count != b.Count)
+ return false;
+
+ EqualityComparer<T> comparer = EqualityComparer<T>.Default;
+
+ for (int i = 0; i < a.Count; i++)
+ {
+ if (!comparer.Equals(a[i], b[i]))
+ return false;
+ }
+
+ return true;
+ }
+
+ #region GetSingleItem
+ public static bool TryGetSingleItem<T>(IList<T> list, out T value)
+ {
+ return TryGetSingleItem<T>(list, false, out value);
+ }
+
+ public static bool TryGetSingleItem<T>(IList<T> list, bool returnDefaultIfEmpty, out T value)
+ {
+ return MiscellaneousUtils.TryAction<T>(delegate { return GetSingleItem(list, returnDefaultIfEmpty); }, out value);
+ }
+
+ public static T GetSingleItem<T>(IList<T> list)
+ {
+ return GetSingleItem<T>(list, false);
+ }
+
+ public static T GetSingleItem<T>(IList<T> list, bool returnDefaultIfEmpty)
+ {
+ if (list.Count == 1)
+ return list[0];
+ else if (returnDefaultIfEmpty && list.Count == 0)
+ return default(T);
+ else
+ throw new Exception(string.Format("Expected single {0} in list but got {1}.", typeof(T), list.Count));
+ }
+ #endregion
+
+ public static IList<T> Minus<T>(IList<T> list, IList<T> minus)
+ {
+ ValidationUtils.ArgumentNotNull(list, "list");
+
+ List<T> result = new List<T>(list.Count);
+ foreach (T t in list)
+ {
+ if (minus == null || !minus.Contains(t))
+ result.Add(t);
+ }
+
+ return result;
+ }
+
+ public static T[] CreateArray<T>(IEnumerable<T> enumerable)
+ {
+ ValidationUtils.ArgumentNotNull(enumerable, "enumerable");
+
+ if (enumerable is T[])
+ return (T[])enumerable;
+
+ List<T> tempList = new List<T>(enumerable);
+ return tempList.ToArray();
+ }
+
+ public static object CreateGenericList(Type listType)
+ {
+ ValidationUtils.ArgumentNotNull(listType, "listType");
+
+ return ReflectionUtils.CreateGeneric(typeof(List<>), listType);
+ }
+
+ public static bool IsListType(Type type)
+ {
+ ValidationUtils.ArgumentNotNull(type, "listType");
+
+ if (type.IsArray)
+ return true;
+ else if (typeof(IList).IsAssignableFrom(type))
+ return true;
+ else if (ReflectionUtils.IsSubClass(type, typeof(IList<>)))
+ return true;
+ else
+ return false;
+ }
+
+ public static IList CreateAndPopulateList(Type listType, Action<IList> populateList)
+ {
+ ValidationUtils.ArgumentNotNull(listType, "listType");
+ ValidationUtils.ArgumentNotNull(populateList, "populateList");
+
+ IList list;
+ Type readOnlyCollectionType;
+ bool isReadOnlyOrFixedSize = false;
+
+ if (listType.IsArray)
+ {
+ // have to use an arraylist when creating array
+ // there is no way to know the size until it is finised
+ list = new ArrayList();
+ isReadOnlyOrFixedSize = true;
+ }
+ else if (ReflectionUtils.IsSubClass(listType, typeof(ReadOnlyCollection<>), out readOnlyCollectionType))
+ {
+ Type readOnlyCollectionContentsType = readOnlyCollectionType.GetGenericArguments()[0];
+ Type genericEnumerable = ReflectionUtils.MakeGenericType(typeof(IEnumerable<>), readOnlyCollectionContentsType);
+ bool suitableConstructor = false;
+
+ foreach (ConstructorInfo constructor in listType.GetConstructors())
+ {
+ IList<ParameterInfo> parameters = constructor.GetParameters();
+
+ if (parameters.Count == 1)
+ {
+ if (genericEnumerable.IsAssignableFrom(parameters[0].ParameterType))
+ {
+ suitableConstructor = true;
+ break;
+ }
+ }
+ }
+
+ if (!suitableConstructor)
+ throw new Exception(string.Format("Readonly type {0} does not have a public constructor that takes a type that implements {1}.", listType, genericEnumerable));
+
+ // can't add or modify a readonly list
+ // use List<T> and convert once populated
+ list = (IList)CreateGenericList(readOnlyCollectionContentsType);
+ isReadOnlyOrFixedSize = true;
+ }
+ else if (typeof(IList).IsAssignableFrom(listType) && ReflectionUtils.IsInstantiatableType(listType))
+ {
+ list = (IList)Activator.CreateInstance(listType);
+ }
+ else
+ {
+ throw new Exception(string.Format("Cannot create and populate list type {0}.", listType));
+ }
+
+ populateList(list);
+
+ // create readonly and fixed sized collections using the temporary list
+ if (isReadOnlyOrFixedSize)
+ {
+ if (listType.IsArray)
+ list = ((ArrayList)list).ToArray(ReflectionUtils.GetListItemType(listType));
+ else if (ReflectionUtils.IsSubClass(listType, typeof(ReadOnlyCollection<>)))
+ list = (IList)Activator.CreateInstance(listType, list);
+ }
+
+ return list;
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/Utilities/JavaScriptUtils.cs b/Src/Newtonsoft.Json/Utilities/JavaScriptUtils.cs new file mode 100644 index 0000000..7bedfbb --- /dev/null +++ b/Src/Newtonsoft.Json/Utilities/JavaScriptUtils.cs @@ -0,0 +1,137 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Web;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace Newtonsoft.Json.Utilities
+{
+ internal static class JavaScriptUtils
+ {
+ public static string GetCallbackEventFunction(Page page, Control control)
+ {
+ string script = page.ClientScript.GetCallbackEventReference(control, "eventArgument", "eventCallback", "context", "errorCallback", true);
+
+ script = "function(eventArgument,eventCallback,context,errorCallback){" + script + "}";
+
+ return script;
+ }
+
+ public static string GetCallbackEventFunction(Page page, Control control, string argument)
+ {
+ string script = page.ClientScript.GetCallbackEventReference(control, "'" + argument + "'", "eventCallback", "context", "errorCallback", true);
+
+ script = "function(eventCallback,context,errorCallback){" + script + "}";
+
+ return script;
+ }
+
+ public static void WriteEscapedJavaScriptChar(TextWriter writer, char c, char delimiter)
+ {
+ switch (c)
+ {
+ case '\t':
+ writer.Write(@"\t");
+ break;
+ case '\n':
+ writer.Write(@"\n");
+ break;
+ case '\r':
+ writer.Write(@"\r");
+ break;
+ case '\f':
+ writer.Write(@"\f");
+ break;
+ case '\b':
+ writer.Write(@"\b");
+ break;
+ case '\\':
+ writer.Write(@"\\");
+ break;
+ //case '<':
+ //case '>':
+ //case '\'':
+ // StringUtils.WriteCharAsUnicode(writer, c);
+ // break;
+ case '"':
+ // only escape if this charater is being used as the delimiter
+ writer.Write((delimiter == '"') ? "\\\"" : null);
+ break;
+ default:
+ if (c > '\u001f')
+ writer.Write(c);
+ else
+ StringUtils.WriteCharAsUnicode(writer, c);
+ break;
+ }
+ }
+
+ public static void WriteEscapedJavaScriptString(TextWriter writer, string value, char delimiter, bool appendDelimiters)
+ {
+ // leading delimiter
+ if (appendDelimiters)
+ writer.Write(delimiter);
+
+ if (value != null)
+ {
+ for (int i = 0; i < value.Length; i++)
+ {
+ WriteEscapedJavaScriptChar(writer, value[i], delimiter);
+ }
+ }
+
+ // trailing delimiter
+ if (appendDelimiters)
+ writer.Write(delimiter);
+ }
+
+ public static string ToEscapedJavaScriptString(string value)
+ {
+ return ToEscapedJavaScriptString(value, '"', true);
+ }
+
+ public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters)
+ {
+ using (StringWriter w = StringUtils.CreateStringWriter(StringUtils.GetLength(value) ?? 16))
+ {
+ WriteEscapedJavaScriptString(w, value, delimiter, appendDelimiters);
+ return w.ToString();
+ }
+ }
+ }
+}
+
+
+
+
diff --git a/Src/Newtonsoft.Json/Utilities/MathUtils.cs b/Src/Newtonsoft.Json/Utilities/MathUtils.cs new file mode 100644 index 0000000..26a6b88 --- /dev/null +++ b/Src/Newtonsoft.Json/Utilities/MathUtils.cs @@ -0,0 +1,60 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json.Utilities
+{
+ internal class MathUtils
+ {
+ public static int HexToInt(char h)
+ {
+ if ((h >= '0') && (h <= '9'))
+ {
+ return (h - '0');
+ }
+ if ((h >= 'a') && (h <= 'f'))
+ {
+ return ((h - 'a') + 10);
+ }
+ if ((h >= 'A') && (h <= 'F'))
+ {
+ return ((h - 'A') + 10);
+ }
+ return -1;
+ }
+
+ public static char IntToHex(int n)
+ {
+ if (n <= 9)
+ {
+ return (char)(n + 48);
+ }
+ return (char)((n - 10) + 97);
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs b/Src/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs new file mode 100644 index 0000000..00d8135 --- /dev/null +++ b/Src/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs @@ -0,0 +1,84 @@ +using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Reflection;
+using System.Text;
+
+namespace Newtonsoft.Json.Utilities
+{
+ internal delegate void Action();
+ internal delegate T Creator<T>();
+ internal delegate T Func<A0, T>(A0 arg0);
+ internal delegate T Func<A0, A1, T>(A0 arg0, A1 arg1);
+ internal delegate T Func<A0, A1, A2, T>(A0 arg0, A1 arg1, A2 arg2);
+
+ internal static class MiscellaneousUtils
+ {
+ public static bool TryAction<T>(Creator<T> creator, out T output)
+ {
+ ValidationUtils.ArgumentNotNull(creator, "creator");
+
+ try
+ {
+ output = creator();
+ return true;
+ }
+ catch
+ {
+ output = default(T);
+ return false;
+ }
+ }
+
+ public static bool TryGetDescription(object value, out string description)
+ {
+ return TryAction<string>(delegate { return GetDescription(value); }, out description);
+ }
+
+ public static string GetDescription(object o)
+ {
+ ValidationUtils.ArgumentNotNull(o, "o");
+
+ ICustomAttributeProvider attributeProvider = o as ICustomAttributeProvider;
+
+ // object passed in isn't an attribute provider
+ // if value is an enum value, get value field member, otherwise get values type
+ if (attributeProvider == null)
+ {
+ Type valueType = o.GetType();
+
+ if (valueType.IsEnum)
+ attributeProvider = valueType.GetField(o.ToString());
+ else
+ attributeProvider = valueType;
+ }
+
+ DescriptionAttribute descriptionAttribute = ReflectionUtils.GetAttribute<DescriptionAttribute>(attributeProvider);
+
+ if (descriptionAttribute != null)
+ return descriptionAttribute.Description;
+ else
+ throw new Exception(string.Format("No DescriptionAttribute on '{0}'.", o.GetType()));
+ }
+
+ public static IList<string> GetDescriptions(IList values)
+ {
+ ValidationUtils.ArgumentNotNull(values, "values");
+
+ string[] descriptions = new string[values.Count];
+
+ for (int i = 0; i < values.Count; i++)
+ {
+ descriptions[i] = GetDescription(values[i]);
+ }
+
+ return descriptions;
+ }
+
+ public static string ToString(object value)
+ {
+ return (value != null) ? value.ToString() : "{null}";
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs b/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs new file mode 100644 index 0000000..75561e5 --- /dev/null +++ b/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs @@ -0,0 +1,524 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Reflection;
+using System.Collections;
+using System.ComponentModel;
+
+namespace Newtonsoft.Json.Utilities
+{
+ internal static class ReflectionUtils
+ {
+ public static Type GetObjectType(object v)
+ {
+ return (v != null) ? v.GetType() : null;
+ }
+
+ public static bool IsInstantiatableType(Type t)
+ {
+ ValidationUtils.ArgumentNotNull(t, "t");
+
+ if (t.IsAbstract || t.IsInterface || t.IsArray || t.IsGenericTypeDefinition || t == typeof(void))
+ return false;
+
+ if (!HasDefaultConstructor(t))
+ return false;
+
+ return true;
+ }
+
+ public static bool HasDefaultConstructor(Type t)
+ {
+ ValidationUtils.ArgumentNotNull(t, "t");
+
+ if (t.IsValueType)
+ return true;
+
+ return (t.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null) != null);
+ }
+
+ public static bool IsNullable(Type t)
+ {
+ ValidationUtils.ArgumentNotNull(t, "t");
+
+ if (t.IsValueType)
+ return IsNullableType(t);
+
+ return true;
+ }
+
+ public static bool IsNullableType(Type t)
+ {
+ ValidationUtils.ArgumentNotNull(t, "t");
+
+ return (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>));
+ }
+
+ //public static bool IsValueTypeUnitializedValue(ValueType value)
+ //{
+ // if (value == null)
+ // return true;
+
+ // return value.Equals(CreateUnitializedValue(value.GetType()));
+ //}
+
+ public static bool IsUnitializedValue(object value)
+ {
+ if (value == null)
+ {
+ return true;
+ }
+ else
+ {
+ object unitializedValue = CreateUnitializedValue(value.GetType());
+ return value.Equals(unitializedValue);
+ }
+ }
+
+ public static object CreateUnitializedValue(Type type)
+ {
+ ValidationUtils.ArgumentNotNull(type, "type");
+
+ if (type.IsGenericTypeDefinition)
+ throw new ArgumentException(string.Format("Type {0} is a generic type definition and cannot be instantiated.", type), "type");
+
+ if (type.IsClass || type.IsInterface || type == typeof(void))
+ return null;
+ else if (type.IsValueType)
+ return Activator.CreateInstance(type);
+ else
+ throw new ArgumentException(string.Format("Type {0} cannot be instantiated.", type), "type");
+ }
+
+ public static bool IsPropertyIndexed(PropertyInfo property)
+ {
+ ValidationUtils.ArgumentNotNull(property, "property");
+
+ return !CollectionUtils.IsNullOrEmpty<ParameterInfo>(property.GetIndexParameters());
+ }
+
+ public static bool IsSubClass(Type type, Type check)
+ {
+ Type implementingType;
+ return IsSubClass(type, check, out implementingType);
+ }
+
+ public static bool IsSubClass(Type type, Type check, out Type implementingType)
+ {
+ ValidationUtils.ArgumentNotNull(type, "type");
+ ValidationUtils.ArgumentNotNull(check, "check");
+
+ return IsSubClassInternal(type, type, check, out implementingType);
+ }
+
+ private static bool IsSubClassInternal(Type initialType, Type currentType, Type check, out Type implementingType)
+ {
+ if (currentType == check)
+ {
+ implementingType = currentType;
+ return true;
+ }
+
+ // don't get interfaces for an interface unless the initial type is an interface
+ if (check.IsInterface && (initialType.IsInterface || currentType == initialType))
+ {
+ foreach (Type t in currentType.GetInterfaces())
+ {
+ if (IsSubClassInternal(initialType, t, check, out implementingType))
+ {
+ // don't return the interface itself, return it's implementor
+ if (check == implementingType)
+ implementingType = currentType;
+
+ return true;
+ }
+ }
+ }
+
+ if (currentType.IsGenericType && !currentType.IsGenericTypeDefinition)
+ {
+ if (IsSubClassInternal(initialType, currentType.GetGenericTypeDefinition(), check, out implementingType))
+ {
+ implementingType = currentType;
+ return true;
+ }
+ }
+
+ if (currentType.BaseType == null)
+ {
+ implementingType = null;
+ return false;
+ }
+
+ return IsSubClassInternal(initialType, currentType.BaseType, check, out implementingType);
+ }
+
+ /// <summary>
+ /// Gets the type of the typed list's items.
+ /// </summary>
+ /// <param name="type">The type.</param>
+ /// <returns>The type of the typed list's items.</returns>
+ public static Type GetListItemType(Type type)
+ {
+ ValidationUtils.ArgumentNotNull(type, "type");
+ Type genericListType;
+
+ if (type.IsArray)
+ {
+ return type.GetElementType();
+ }
+ else if (IsSubClass(type, typeof(IList<>), out genericListType))
+ {
+ if (genericListType.IsGenericTypeDefinition)
+ throw new Exception(string.Format("Type {0} is not a list.", type));
+
+ return genericListType.GetGenericArguments()[0];
+ }
+ else if (typeof(IList).IsAssignableFrom(type))
+ {
+ return null;
+ }
+ else
+ {
+ throw new Exception(string.Format("Type {0} is not a list.", type));
+ }
+ }
+
+ public static Type GetDictionaryValueType(Type type)
+ {
+ ValidationUtils.ArgumentNotNull(type, "type");
+
+ Type genericDictionaryType;
+ if (IsSubClass(type, typeof(IDictionary<,>), out genericDictionaryType))
+ {
+ if (genericDictionaryType.IsGenericTypeDefinition)
+ throw new Exception(string.Format("Type {0} is not a dictionary.", type));
+
+ return genericDictionaryType.GetGenericArguments()[1];
+ }
+ else if (typeof(IDictionary).IsAssignableFrom(type))
+ {
+ return null;
+ }
+ else
+ {
+ throw new Exception(string.Format("Type {0} is not a dictionary.", type));
+ }
+ }
+
+ /// <summary>
+ /// Tests whether the list's items are their unitialized value.
+ /// </summary>
+ /// <param name="list">The list.</param>
+ /// <returns>Whether the list's items are their unitialized value</returns>
+ public static bool ItemsUnitializedValue<T>(IList<T> list)
+ {
+ ValidationUtils.ArgumentNotNull(list, "list");
+
+ Type elementType = GetListItemType(list.GetType());
+
+ if (elementType.IsValueType)
+ {
+ object unitializedValue = CreateUnitializedValue(elementType);
+
+ for (int i = 0; i < list.Count; i++)
+ {
+ if (!list[i].Equals(unitializedValue))
+ return false;
+ }
+ }
+ else if (elementType.IsClass)
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ object value = list[i];
+
+ if (value != null)
+ return false;
+ }
+ }
+ else
+ {
+ throw new Exception(string.Format("Type {0} is neither a ValueType or a Class.", elementType));
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Gets the member's underlying type.
+ /// </summary>
+ /// <param name="member">The member.</param>
+ /// <returns>The underlying type of the member.</returns>
+ public static Type GetMemberUnderlyingType(MemberInfo member)
+ {
+ ValidationUtils.ArgumentNotNull(member, "member");
+
+ switch (member.MemberType)
+ {
+ case MemberTypes.Field:
+ return ((FieldInfo)member).FieldType;
+ case MemberTypes.Property:
+ return ((PropertyInfo)member).PropertyType;
+ case MemberTypes.Event:
+ return ((EventInfo)member).EventHandlerType;
+ default:
+ throw new ArgumentException("MemberInfo must be if type FieldInfo, PropertyInfo or EventInfo", "member");
+ }
+ }
+
+ /// <summary>
+ /// Determines whether the member is an indexed property.
+ /// </summary>
+ /// <param name="member">The member.</param>
+ /// <returns>
+ /// <c>true</c> if the member is an indexed property; otherwise, <c>false</c>.
+ /// </returns>
+ public static bool IsIndexedProperty(MemberInfo member)
+ {
+ ValidationUtils.ArgumentNotNull(member, "member");
+
+ PropertyInfo propertyInfo = member as PropertyInfo;
+
+ if (propertyInfo != null)
+ return IsIndexedProperty(propertyInfo);
+ else
+ return false;
+ }
+
+ /// <summary>
+ /// Determines whether the property is an indexed property.
+ /// </summary>
+ /// <param name="property">The property.</param>
+ /// <returns>
+ /// <c>true</c> if the property is an indexed property; otherwise, <c>false</c>.
+ /// </returns>
+ public static bool IsIndexedProperty(PropertyInfo property)
+ {
+ ValidationUtils.ArgumentNotNull(property, "property");
+
+ return (property.GetIndexParameters().Length > 0);
+ }
+
+ public static MemberInfo GetMember(Type type, string name, MemberTypes memberTypes)
+ {
+ return GetMember(type, name, memberTypes, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
+ }
+
+ public static MemberInfo GetMember(Type type, string name, MemberTypes memberTypes, BindingFlags bindingAttr)
+ {
+ ValidationUtils.ArgumentNotNull(type, "type");
+ ValidationUtils.ArgumentNotNull(name, "name");
+
+ MemberInfo[] result = type.GetMember(name, memberTypes, bindingAttr);
+
+ return CollectionUtils.GetSingleItem<MemberInfo>(result);
+ }
+
+ /// <summary>
+ /// Gets the member's value on the object.
+ /// </summary>
+ /// <param name="member">The member.</param>
+ /// <param name="target">The target object.</param>
+ /// <returns>The member's value on the object.</returns>
+ public static object GetMemberValue(MemberInfo member, object target)
+ {
+ ValidationUtils.ArgumentNotNull(member, "member");
+ ValidationUtils.ArgumentNotNull(target, "target");
+
+ switch (member.MemberType)
+ {
+ case MemberTypes.Field:
+ return ((FieldInfo)member).GetValue(target);
+ case MemberTypes.Property:
+ try
+ {
+ return ((PropertyInfo)member).GetValue(target, null);
+ }
+ catch (TargetParameterCountException e)
+ {
+ throw new ArgumentException(string.Format("MemberInfo '{0}' has index parameters", member.Name), "member", e);
+ }
+ default:
+ throw new ArgumentException(string.Format("MemberInfo '{0}' is not of type FieldInfo or PropertyInfo", member.Name), "member");
+ }
+ }
+
+ /// <summary>
+ /// Sets the member's value on the target object.
+ /// </summary>
+ /// <param name="member">The member.</param>
+ /// <param name="target">The target.</param>
+ /// <param name="value">The value.</param>
+ public static void SetMemberValue(MemberInfo member, object target, object value)
+ {
+ ValidationUtils.ArgumentNotNull(member, "member");
+ ValidationUtils.ArgumentNotNull(target, "target");
+
+ switch (member.MemberType)
+ {
+ case MemberTypes.Field:
+ ((FieldInfo)member).SetValue(target, value);
+ break;
+ case MemberTypes.Property:
+ ((PropertyInfo)member).SetValue(target, value, null);
+ break;
+ default:
+ throw new ArgumentException(string.Format("MemberInfo '{0}' must be of type FieldInfo or PropertyInfo", member.Name), "member");
+ }
+ }
+
+ /// <summary>
+ /// Determines whether the specified MemberInfo can be read.
+ /// </summary>
+ /// <param name="member">The MemberInfo to determine whether can be read.</param>
+ /// <returns>
+ /// <c>true</c> if the specified MemberInfo can be read; otherwise, <c>false</c>.
+ /// </returns>
+ public static bool CanReadMemberValue(MemberInfo member)
+ {
+ switch (member.MemberType)
+ {
+ case MemberTypes.Field:
+ return true;
+ case MemberTypes.Property:
+ return ((PropertyInfo)member).CanRead;
+ default:
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Determines whether the specified MemberInfo can be set.
+ /// </summary>
+ /// <param name="member">The MemberInfo to determine whether can be set.</param>
+ /// <returns>
+ /// <c>true</c> if the specified MemberInfo can be set; otherwise, <c>false</c>.
+ /// </returns>
+ public static bool CanSetMemberValue(MemberInfo member)
+ {
+ switch (member.MemberType)
+ {
+ case MemberTypes.Field:
+ return true;
+ case MemberTypes.Property:
+ return ((PropertyInfo)member).CanWrite;
+ default:
+ return false;
+ }
+ }
+
+ public static List<MemberInfo> GetFieldsAndProperties<T>(BindingFlags bindingAttr)
+ {
+ return GetFieldsAndProperties(typeof(T), bindingAttr);
+ }
+
+ public static List<MemberInfo> GetFieldsAndProperties(Type type, BindingFlags bindingAttr)
+ {
+ List<MemberInfo> targetMembers = new List<MemberInfo>();
+
+ targetMembers.AddRange(type.GetFields(bindingAttr));
+ targetMembers.AddRange(type.GetProperties(bindingAttr));
+
+ return targetMembers;
+ }
+
+ public static T GetAttribute<T>(ICustomAttributeProvider attributeProvider) where T : Attribute
+ {
+ return GetAttribute<T>(attributeProvider, true);
+ }
+
+ public static T GetAttribute<T>(ICustomAttributeProvider attributeProvider, bool inherit) where T : Attribute
+ {
+ T[] attributes = GetAttributes<T>(attributeProvider, inherit);
+
+ return CollectionUtils.GetSingleItem(attributes, true);
+ }
+
+ public static T[] GetAttributes<T>(ICustomAttributeProvider attributeProvider, bool inherit) where T : Attribute
+ {
+ ValidationUtils.ArgumentNotNull(attributeProvider, "attributeProvider");
+
+ return (T[])attributeProvider.GetCustomAttributes(typeof(T), inherit);
+ }
+
+ public static string GetNameAndAssessmblyName(Type t)
+ {
+ ValidationUtils.ArgumentNotNull(t, "t");
+
+ return t.FullName + ", " + t.Assembly.GetName().Name;
+ }
+
+ public static List<MemberInfo> FindMembers(Type targetType, MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria)
+ {
+ ValidationUtils.ArgumentNotNull(targetType, "targetType");
+
+ List<MemberInfo> memberInfos = new List<MemberInfo>(targetType.FindMembers(memberType, bindingAttr, filter, filterCriteria));
+
+ // fix weirdness with FieldInfos only being returned for the current Type
+ // find base type fields and add them to result
+ if ((memberType & MemberTypes.Field) != 0
+ && (bindingAttr & BindingFlags.NonPublic) != 0)
+ {
+ // modify flags to not search for public fields
+ BindingFlags nonPublicBindingAttr = bindingAttr ^ BindingFlags.Public;
+
+ while ((targetType = targetType.BaseType) != null)
+ {
+ memberInfos.AddRange(targetType.FindMembers(MemberTypes.Field, nonPublicBindingAttr, filter, filterCriteria));
+ }
+ }
+
+ return memberInfos;
+ }
+
+ public static Type MakeGenericType(Type genericTypeDefinition, params Type[] innerTypes)
+ {
+ ValidationUtils.ArgumentNotNull(genericTypeDefinition, "genericTypeDefinition");
+ ValidationUtils.ArgumentNotNullOrEmpty<Type>(innerTypes, "innerTypes");
+ ValidationUtils.ArgumentConditionTrue(genericTypeDefinition.IsGenericTypeDefinition, "genericTypeDefinition", string.Format("Type {0} is not a generic type definition.", genericTypeDefinition));
+
+ return genericTypeDefinition.MakeGenericType(innerTypes);
+ }
+
+ public static object CreateGeneric(Type genericTypeDefinition, Type innerType, params object[] args)
+ {
+ return CreateGeneric(genericTypeDefinition, new Type[] { innerType }, args);
+ }
+
+ public static object CreateGeneric(Type genericTypeDefinition, IList<Type> innerTypes, params object[] args)
+ {
+ ValidationUtils.ArgumentNotNull(genericTypeDefinition, "genericTypeDefinition");
+ ValidationUtils.ArgumentNotNullOrEmpty(innerTypes, "innerTypes");
+
+ Type specificType = MakeGenericType(genericTypeDefinition, CollectionUtils.CreateArray(innerTypes));
+
+ return Activator.CreateInstance(specificType, args);
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json/Utilities/StringUtils.cs b/Src/Newtonsoft.Json/Utilities/StringUtils.cs new file mode 100644 index 0000000..8861c15 --- /dev/null +++ b/Src/Newtonsoft.Json/Utilities/StringUtils.cs @@ -0,0 +1,396 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Data.SqlTypes;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace Newtonsoft.Json.Utilities
+{
+ internal static class StringUtils
+ {
+ public const string CarriageReturnLineFeed = "\r\n";
+ public const string Empty = "";
+ public const char CarriageReturn = '\r';
+ public const char LineFeed = '\n';
+ public const char Tab = '\t';
+
+ /// <summary>
+ /// Determines whether the string contains white space.
+ /// </summary>
+ /// <param name="s">The string to test for white space.</param>
+ /// <returns>
+ /// <c>true</c> if the string contains white space; otherwise, <c>false</c>.
+ /// </returns>
+ public static bool ContainsWhiteSpace(string s)
+ {
+ if (s == null)
+ throw new ArgumentNullException("s");
+
+ for (int i = 0; i < s.Length; i++)
+ {
+ if (char.IsWhiteSpace(s[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Determines whether the string is all white space. Empty string will return false.
+ /// </summary>
+ /// <param name="s">The string to test whether it is all white space.</param>
+ /// <returns>
+ /// <c>true</c> if the string is all white space; otherwise, <c>false</c>.
+ /// </returns>
+ public static bool IsWhiteSpace(string s)
+ {
+ if (s == null)
+ throw new ArgumentNullException("s");
+
+ if (s.Length == 0)
+ return false;
+
+ for (int i = 0; i < s.Length; i++)
+ {
+ if (!char.IsWhiteSpace(s[i]))
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Ensures the target string ends with the specified string.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ /// <param name="value">The value.</param>
+ /// <returns>The target string with the value string at the end.</returns>
+ public static string EnsureEndsWith(string target, string value)
+ {
+ if (target == null)
+ throw new ArgumentNullException("target");
+
+ if (value == null)
+ throw new ArgumentNullException("value");
+
+ if (target.Length >= value.Length)
+ {
+ if (string.Compare(target, target.Length - value.Length, value, 0, value.Length, StringComparison.OrdinalIgnoreCase) ==
+ 0)
+ return target;
+
+ string trimmedString = target.TrimEnd(null);
+
+ if (string.Compare(trimmedString, trimmedString.Length - value.Length, value, 0, value.Length,
+ StringComparison.OrdinalIgnoreCase) == 0)
+ return target;
+ }
+
+ return target + value;
+ }
+
+ /// <summary>
+ /// Determines whether the SqlString is null or empty.
+ /// </summary>
+ /// <param name="s">The string.</param>
+ /// <returns>
+ /// <c>true</c> if the SqlString is null or empty; otherwise, <c>false</c>.
+ /// </returns>
+ public static bool IsNullOrEmpty(SqlString s)
+ {
+ if (s.IsNull)
+ return true;
+ else
+ return string.IsNullOrEmpty(s.Value);
+ }
+
+ public static bool IsNullOrEmptyOrWhiteSpace(string s)
+ {
+ if (string.IsNullOrEmpty(s))
+ return true;
+ else if (IsWhiteSpace(s))
+ return true;
+ else
+ return false;
+ }
+
+ /// <summary>
+ /// Perform an action if the string is not null or empty.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <param name="action">The action to perform.</param>
+ public static void IfNotNullOrEmpty(string value, Action<string> action)
+ {
+ IfNotNullOrEmpty(value, action, null);
+ }
+
+ private static void IfNotNullOrEmpty(string value, Action<string> trueAction, Action<string> falseAction)
+ {
+ if (!string.IsNullOrEmpty(value))
+ {
+ if (trueAction != null)
+ trueAction(value);
+ }
+ else
+ {
+ if (falseAction != null)
+ falseAction(value);
+ }
+ }
+
+ /// <summary>
+ /// Indents the specified string.
+ /// </summary>
+ /// <param name="s">The string to indent.</param>
+ /// <param name="indentation">The number of characters to indent by.</param>
+ /// <returns></returns>
+ public static string Indent(string s, int indentation)
+ {
+ return Indent(s, indentation, ' ');
+ }
+
+ /// <summary>
+ /// Indents the specified string.
+ /// </summary>
+ /// <param name="s">The string to indent.</param>
+ /// <param name="indentation">The number of characters to indent by.</param>
+ /// <param name="indentChar">The indent character.</param>
+ /// <returns></returns>
+ public static string Indent(string s, int indentation, char indentChar)
+ {
+ if (s == null)
+ throw new ArgumentNullException("s");
+
+ if (indentation <= 0)
+ throw new ArgumentException("Must be greater than zero.", "indentation");
+
+ StringReader sr = new StringReader(s);
+ StringWriter sw = new StringWriter();
+
+ ActionTextReaderLine(sr, sw, delegate(TextWriter tw, string line)
+ {
+ tw.Write(new string(indentChar, indentation));
+ tw.Write(line);
+ });
+
+ return sw.ToString();
+ }
+
+ private delegate void ActionLine(TextWriter textWriter, string line);
+
+ private static void ActionTextReaderLine(TextReader textReader, TextWriter textWriter, ActionLine lineAction)
+ {
+ string line;
+ bool firstLine = true;
+ while ((line = textReader.ReadLine()) != null)
+ {
+ if (!firstLine)
+ textWriter.WriteLine();
+ else
+ firstLine = false;
+
+ lineAction(textWriter, line);
+ }
+ }
+
+ /// <summary>
+ /// Numbers the lines.
+ /// </summary>
+ /// <param name="s">The string to number.</param>
+ /// <returns></returns>
+ public static string NumberLines(string s)
+ {
+ if (s == null)
+ throw new ArgumentNullException("s");
+
+ StringReader sr = new StringReader(s);
+ StringWriter sw = new StringWriter();
+
+ int lineNumber = 1;
+
+ ActionTextReaderLine(sr, sw, delegate(TextWriter tw, string line)
+ {
+ tw.Write(lineNumber.ToString().PadLeft(4));
+ tw.Write(". ");
+ tw.Write(line);
+
+ lineNumber++;
+ });
+
+ return sw.ToString();
+ }
+
+ /// <summary>
+ /// Nulls an empty string.
+ /// </summary>
+ /// <param name="s">The string.</param>
+ /// <returns>Null if the string was null, otherwise the string unchanged.</returns>
+ public static string NullEmptyString(string s)
+ {
+ return (string.IsNullOrEmpty(s)) ? null : s;
+ }
+
+ public static string ReplaceNewLines(string s, string replacement)
+ {
+ StringReader sr = new StringReader(s);
+ StringBuilder sb = new StringBuilder();
+
+ bool first = true;
+
+ string line;
+ while ((line = sr.ReadLine()) != null)
+ {
+ if (first)
+ first = false;
+ else
+ sb.Append(replacement);
+
+ sb.Append(line);
+ }
+
+ return sb.ToString();
+ }
+
+ public static string RemoveHtml(string s)
+ {
+ return RemoveHtmlInternal(s, null);
+ }
+
+ public static string RemoveHtml(string s, IList<string> removeTags)
+ {
+ if (removeTags == null)
+ throw new ArgumentNullException("removeTags");
+
+ return RemoveHtmlInternal(s, removeTags);
+ }
+
+ private static string RemoveHtmlInternal(string s, IList<string> removeTags)
+ {
+ List<string> removeTagsUpper = null;
+
+ if (removeTags != null)
+ {
+ removeTagsUpper = new List<string>(removeTags.Count);
+
+ foreach (string tag in removeTags)
+ {
+ removeTagsUpper.Add(tag.ToUpperInvariant());
+ }
+ }
+
+ Regex anyTag = new Regex(@"<[/]{0,1}\s*(?<tag>\w*)\s*(?<attr>.*?=['""].*?[""'])*?\s*[/]{0,1}>", RegexOptions.Compiled);
+
+ return anyTag.Replace(s, delegate(Match match)
+ {
+ string tag = match.Groups["tag"].Value.ToUpperInvariant();
+
+ if (removeTagsUpper == null)
+ return string.Empty;
+ else if (removeTagsUpper.Contains(tag))
+ return string.Empty;
+ else
+ return match.Value;
+ });
+ }
+
+ public static string Truncate(string s, int maximumLength)
+ {
+ return Truncate(s, maximumLength, "...");
+ }
+
+ public static string Truncate(string s, int maximumLength, string suffix)
+ {
+ if (suffix == null)
+ throw new ArgumentNullException("suffix");
+
+ if (maximumLength <= 0)
+ throw new ArgumentException("Maximum length must be greater than zero.", "maximumLength");
+
+ int subStringLength = maximumLength - suffix.Length;
+
+ if (subStringLength <= 0)
+ throw new ArgumentException("Length of suffix string is greater or equal to maximumLength");
+
+ if (s != null && s.Length > maximumLength)
+ {
+ string truncatedString = s.Substring(0, subStringLength);
+ // incase the last character is a space
+ truncatedString = truncatedString.Trim();
+ truncatedString += suffix;
+
+ return truncatedString;
+ }
+ else
+ {
+ return s;
+ }
+ }
+
+ public static StringWriter CreateStringWriter(int capacity)
+ {
+ StringBuilder sb = new StringBuilder(capacity);
+ StringWriter sw = new StringWriter(sb);
+
+ return sw;
+ }
+
+ public static int? GetLength(string value)
+ {
+ if (value == null)
+ return null;
+ else
+ return value.Length;
+ }
+
+ public static string ToCharAsUnicode(char c)
+ {
+ using (StringWriter w = new StringWriter())
+ {
+ WriteCharAsUnicode(w, c);
+ return w.ToString();
+ }
+ }
+
+ public static void WriteCharAsUnicode(TextWriter writer, char c)
+ {
+ ValidationUtils.ArgumentNotNull(writer, "writer");
+
+ char h1 = MathUtils.IntToHex((c >> 12) & '\x000f');
+ char h2 = MathUtils.IntToHex((c >> 8) & '\x000f');
+ char h3 = MathUtils.IntToHex((c >> 4) & '\x000f');
+ char h4 = MathUtils.IntToHex(c & '\x000f');
+
+ writer.Write('\\');
+ writer.Write('u');
+ writer.Write(h1);
+ writer.Write(h2);
+ writer.Write(h3);
+ writer.Write(h4);
+ }
+ }
+}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/Utilities/ValidationUtils.cs b/Src/Newtonsoft.Json/Utilities/ValidationUtils.cs new file mode 100644 index 0000000..aae4e05 --- /dev/null +++ b/Src/Newtonsoft.Json/Utilities/ValidationUtils.cs @@ -0,0 +1,148 @@ +#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Newtonsoft.Json.Utilities
+{
+ internal static class ValidationUtils
+ {
+ public const string EmailAddressRegex = @"^([a-zA-Z0-9_'+*$%\^&!\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9:]{2,4})+$";
+ public const string CurrencyRegex = @"(^\$?(?!0,?\d)\d{1,3}(,?\d{3})*(\.\d\d)?)$";
+ public const string DateRegex =
+ @"^(((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00|[048])))$";
+ public const string NumericRegex = @"\d*";
+
+ public static void ArgumentNotNullOrEmpty(string value, string parameterName)
+ {
+ if (value == null)
+ throw new ArgumentNullException(parameterName);
+
+ if (value.Length == 0)
+ throw new ArgumentException(string.Format("'{0}' cannot be empty.", parameterName), parameterName);
+ }
+
+ public static void ArgumentNotNullOrEmptyOrWhitespace(string value, string parameterName)
+ {
+ ArgumentNotNullOrEmpty(value, parameterName);
+
+ if (StringUtils.IsWhiteSpace(value))
+ throw new ArgumentException(string.Format("'{0}' cannot only be whitespace.", parameterName), parameterName);
+ }
+
+ public static void ArgumentTypeIsEnum(Type enumType, string parameterName)
+ {
+ ArgumentNotNull(enumType, "enumType");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException(string.Format("Type {0} is not an Enum.", enumType), parameterName);
+ }
+
+ public static void ArgumentNotNullOrEmpty<T>(ICollection<T> collection, string parameterName)
+ {
+ ArgumentNotNullOrEmpty<T>(collection, parameterName, string.Format("Collection '{0}' cannot be empty.", parameterName));
+ }
+
+ public static void ArgumentNotNullOrEmpty<T>(ICollection<T> collection, string parameterName, string message)
+ {
+ if (collection == null)
+ throw new ArgumentNullException(parameterName);
+
+ if (collection.Count == 0)
+ throw new ArgumentException(message, parameterName);
+ }
+
+ public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName)
+ {
+ ArgumentNotNullOrEmpty(collection, parameterName, string.Format("Collection '{0}' cannot be empty.", parameterName));
+ }
+
+ public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName, string message)
+ {
+ if (collection == null)
+ throw new ArgumentNullException(parameterName);
+
+ if (collection.Count == 0)
+ throw new ArgumentException(message, parameterName);
+ }
+
+ public static void ArgumentNotNull(object value, string parameterName)
+ {
+ if (value == null)
+ throw new ArgumentNullException(parameterName);
+ }
+
+ public static void ArgumentNotNegative(int value, string parameterName)
+ {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException(parameterName, value, "Argument cannot be negative.");
+ }
+
+ public static void ArgumentNotNegative(int value, string parameterName, string message)
+ {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException(parameterName, value, message);
+ }
+
+ public static void ArgumentNotZero(int value, string parameterName)
+ {
+ if (value == 0)
+ throw new ArgumentOutOfRangeException(parameterName, value, "Argument cannot be zero.");
+ }
+
+ public static void ArgumentNotZero(int value, string parameterName, string message)
+ {
+ if (value == 0)
+ throw new ArgumentOutOfRangeException(parameterName, value, message);
+ }
+
+ public static void ArgumentIsPositive<T>(T value, string parameterName) where T : struct, IComparable<T>
+ {
+ if (value.CompareTo(default(T)) != 1)
+ throw new ArgumentOutOfRangeException(parameterName, value, "Positive number required.");
+ }
+
+ public static void ArgumentIsPositive(int value, string parameterName, string message)
+ {
+ if (value > 0)
+ throw new ArgumentOutOfRangeException(parameterName, value, message);
+ }
+
+ public static void ObjectNotDisposed(bool disposed, Type objectType)
+ {
+ if (disposed)
+ throw new ObjectDisposedException(objectType.Name);
+ }
+
+ public static void ArgumentConditionTrue(bool condition, string parameterName, string message)
+ {
+ if (!condition)
+ throw new ArgumentException(message, parameterName);
+ }
+ }
+}
\ No newline at end of file |