diff --git a/Spring.build b/Spring.build
index ec89656dd..7d10157cb 100644
--- a/Spring.build
+++ b/Spring.build
@@ -573,255 +573,24 @@ Commandline Examples:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/Mono/2.0/DotNetMock.Framework.dll b/lib/Mono/2.0/DotNetMock.Framework.dll
deleted file mode 100644
index b91f079ff..000000000
Binary files a/lib/Mono/2.0/DotNetMock.Framework.dll and /dev/null differ
diff --git a/lib/Mono/2.0/DotNetMock.dll b/lib/Mono/2.0/DotNetMock.dll
deleted file mode 100644
index 794065d35..000000000
Binary files a/lib/Mono/2.0/DotNetMock.dll and /dev/null differ
diff --git a/lib/Mono/2.0/Rhino.Mocks.dll b/lib/Mono/2.0/Rhino.Mocks.dll
deleted file mode 100644
index 3fc4b2ae4..000000000
Binary files a/lib/Mono/2.0/Rhino.Mocks.dll and /dev/null differ
diff --git a/lib/Mono/2.0/Rhino.Mocks.xml b/lib/Mono/2.0/Rhino.Mocks.xml
deleted file mode 100644
index d6ae366d2..000000000
--- a/lib/Mono/2.0/Rhino.Mocks.xml
+++ /dev/null
@@ -1,5624 +0,0 @@
-
-
-
- Rhino.Mocks
-
-
-
-
- Defines constraints and return values for arguments of a mock.
- Only use Arg inside a method call on a mock that is recording.
- Example:
- ExpectCall(
- mock.foo(
- Arg<int>.Is.GreaterThan(2),
- Arg<string>.Is.Anything
- ));
- Use Arg.Text for string specific constraints
- Use Arg<ListClass>.List for list specific constraints
-
-
-
-
-
- Register the predicate as a constraint for the current call.
-
- The predicate.
- default(T)
-
- Allow you to use code to create constraints
-
- demo.AssertWasCalled(x => x.Bar(Arg{string}.Matches(a => a.StartsWith("b") && a.Contains("ba"))));
-
-
-
-
-
- Define a complex constraint for this argument by passing several constraints
- combined with operators. (Use Is in simple cases.)
- Example: Arg<string>.Matches(Is.Equal("Hello") || Text.EndsWith("u"));
-
- Constraints using Is, Text and List
- Dummy to satisfy the compiler
-
-
-
- Define a Ref argument.
-
- Constraints for this argument
- value returned by the mock
-
-
-
-
- Define a out parameter. Use it together with the keyword out and use the
- Dummy field available by the return value.
- Example: mock.foo( out Arg<string>.Out("hello").Dummy );
-
-
-
-
-
-
- Define a simple constraint for this argument. (Use Matches in simple cases.)
- Example:
- Arg<int>.Is.Anthing
- Arg<string>.Is.Equal("hello")
-
-
-
-
- Define Constraints on list arguments.
-
-
-
-
- Use the Arg class (without generic) to define Text constraints
-
-
-
-
- Evaluate an equal constraint for .
-
- The object the parameter should equal to
-
-
-
- Define constraints on text arguments.
-
-
-
-
- Used to manage the static state of the Arg<T> class"/>
-
-
-
-
- Resets the static state
-
-
-
-
- Returns return values for the out and ref parameters
- Note: the array returned has the size of the number of out and ref
- argument definitions
-
-
-
-
-
- Returns the constraints for all arguments.
- Out arguments have an Is.Anything constraint and are also in the list.
-
-
-
-
-
- What should BackToRecord clear
-
-
-
-
- Retain all expectations and behaviors and return to mock
-
-
-
-
- All expectations
-
-
-
-
- Event subscribers for this instance
-
-
-
-
- Methods that should be forwarded to the base class implementation
-
-
-
-
- Properties that should behave like properties
-
-
-
-
- Remove all the behavior of the object
-
-
-
-
- Interface for constraints
-
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- And operator for constraints
-
-
-
-
- Not operator for constraints
-
-
-
-
- Or operator for constraints
-
-
-
-
- Allow overriding of || or &&
-
-
-
-
-
-
- Allow overriding of || or &&
-
-
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constrain that the public field has a specified value
-
-
-
-
- Constrain that the public field matches another constraint.
-
-
-
-
- Creates a new instance.
-
- Name of the public field.
- Constraint to place on the public field value.
-
-
-
- Creates a new instance, specifying a disambiguating
- for the public field.
-
- The type that declares the public field, used to disambiguate between public fields.
- Name of the public field.
- Constraint to place on the public field value.
-
-
-
- Determines if the object passes the constraint.
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Creates a new instance.
-
- Name of the public field.
- Expected value.
-
-
-
- Creates a new instance, specifying a disambiguating
- for the public field.
-
- The type that declares the public field, used to disambiguate between public fields.
- Name of the public field.
- Expected value.
-
-
-
- Constrain that the property has a specified value
-
-
-
-
- Constrain that the property matches another constraint.
-
-
-
-
- Creates a new instance.
-
- Name of the property.
- Constraint to place on the property value.
-
-
-
- Creates a new instance, specifying a disambiguating
- for the property.
-
- The type that declares the property, used to disambiguate between properties.
- Name of the property.
- Constraint to place on the property value.
-
-
-
- Determines if the object passes the constraint.
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Creates a new instance.
-
- Name of the property.
- Expected value.
-
-
-
- Creates a new instance, specifying a disambiguating
- for the property.
-
- The type that declares the property, used to disambiguate between properties.
- Name of the property.
- Expected value.
-
-
-
- Constrain that the parameter must be of the specified type
-
-
-
-
- Creates a new instance.
-
- Type.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constraint that determines whether an object is the same object as another.
-
-
-
-
- Creates a new instance.
-
- Obj.
-
-
-
- Determines if the object passes the constraints.
-
-
-
-
- Gets the message for this constraint.
-
-
-
-
- Evaluate a parameter using constraints
-
-
-
-
- Create new instance
-
-
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- A constraint based on lambda expression, we are using Expression{T}
- because we want to be able to get good error reporting on that.
-
-
-
-
- Initializes a new instance of the class.
-
- The expr.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constrain that the list contains the same items as the parameter list
-
-
-
-
- Creates a new instance.
-
- In list.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constrain that the parameter is one of the items in the list
-
-
-
-
- Creates a new instance.
-
- In list.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constrain that the object is inside the parameter list
-
-
-
-
- Creates a new instance.
-
- In list.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Applies another AbstractConstraint to the collection count.
-
-
-
-
- Creates a new instance.
-
- The constraint that should be applied to the collection count.
-
-
-
- Determines if the parameter conforms to this constraint.
-
-
-
-
- Gets the message for this constraint.
-
-
-
-
- Applies another AbstractConstraint to a specific list element.
-
-
-
-
- Creates a new instance.
-
- The zero-based index of the list element.
- The constraint that should be applied to the list element.
-
-
-
- Determines if the parameter conforms to this constraint.
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Applies another AbstractConstraint to a specific generic keyed list element.
-
-
-
-
- Creates a new instance.
-
- The key of the list element.
- The constraint that should be applied to the list element.
-
-
-
- Determines if the parameter conforms to this constraint.
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constrains that all elements are in the parameter list
-
-
-
-
- Initializes a new instance of the class.
-
- The these.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Combines two constraints, constraint pass if either is fine.
-
-
-
-
- Creates a new instance.
-
- C1.
- C2.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Negate a constraint
-
-
-
-
- Creates a new instance.
-
- C1.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Combines two constraints
-
-
-
-
-
- Creates a new instance.
-
- C1.
- C2.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constrain the argument to validate according to regex pattern
-
-
-
-
- Creates a new instance.
-
- Pattern.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constraint that evaluate whatever an argument contains the specified string.
-
-
-
-
- Creates a new instance.
-
- Inner string.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constraint that evaluate whatever an argument ends with the specified string
-
-
-
-
- Creates a new instance.
-
- End.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constraint that evaluate whatever an argument start with the specified string
-
-
-
-
- Creates a new instance.
-
- Start.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constraint that evaluate whatever an object equals another
-
-
-
-
- Creates a new instance.
-
- Obj.
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constraint that always returns true
-
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Constraint that evaluate whatever a comparable is greater than another
-
-
-
-
- Creates a new instance.
-
-
-
-
- Determines if the object pass the constraints
-
-
-
-
- Gets the message for this constraint
-
-
-
-
-
- Initializes a new constraint object.
-
- The expected object, The actual object is passed in as a parameter to the method
-
-
-
- Evaluate this constraint.
-
- The actual object that was passed in the method call to the mock.
- True when the constraint is met, else false.
-
-
-
- Checks if the properties of the object
- are the same as the properies of the object.
-
- The expected object
- The actual object
- True when both objects have the same values, else False.
-
-
-
-
-
-
-
-
- This is the real heart of the beast.
-
-
-
- Used by CheckReferenceType to check all properties of the reference type.
-
- The expected object
- The actual object
- True when both objects have the same values, else False.
-
-
-
- Used by CheckReferenceType to check all fields of the reference type.
-
- The expected object
- The actual object
- True when both objects have the same values, else False.
-
-
-
- Checks the items of both collections
-
- The expected collection
-
- True if both collections contain the same items in the same order.
-
-
-
- Builds a propertyname from the Stack _properties like 'Order.Product.Price'
- to be used in the error message.
-
- A nested property name.
-
-
-
- Rhino.Mocks uses this property to generate an error message.
-
-
- A message telling the tester why the constraint failed.
-
-
-
-
- Provides access to the constraintes defined in the class to be used in context
- with the syntax.
-
- The type of the argument
-
-
-
- Evaluate a greater than constraint for .
-
- The object the parameter should be greater than
-
-
-
- Evaluate a less than constraint for .
-
- The object the parameter should be less than
-
-
-
- Evaluate a less than or equal constraint for .
-
- The object the parameter should be less than or equal to
-
-
-
- Evaluate a greater than or equal constraint for .
-
- The object the parameter should be greater than or equal to
-
-
-
- Evaluate an equal constraint for .
-
- The object the parameter should equal to
-
-
-
- Converts the object type to a better match if this is a primitive type.
-
- The obj.
-
-
-
-
- Converts the object type to match.
-
-
- Because of implicit conversions and the way ArgConstraints this method is needed to check
- object type and potentially change the object type for a better "match" so that obj1.Equals(obj2)
- will return the proper "answer"
-
- The obj.
-
-
-
-
- Evaluate a not equal constraint for .
-
- The object the parameter should not equal to
-
-
-
- Evaluate a same as constraint.
-
- The object the parameter should the same as.
-
-
-
- Evaluate a not same as constraint.
-
- The object the parameter should not be the same as.
-
-
-
- Throws NotSupportedException. Don't use Equals to define constraints. Use Equal instead.
-
-
-
-
-
-
- Serves as a hash function for a particular type.
-
-
- A hash code for the current .
-
-
-
-
- A constraints that accept anything
-
-
-
-
-
- A constraint that accept only nulls
-
-
-
-
-
- A constraint that accept only non null values
-
-
-
-
-
- A constraint that accept only value of the specified type.
- The check is performed on the type that has been defined
- as the argument type.
-
-
-
-
- Provides access to the constraints defined in the class to be used in context
- with the syntax.
-
-
-
-
- Determines whether the specified object is in the parameter.
- The parameter must be IEnumerable.
-
- Obj.
-
-
-
-
- Determines whatever the parameter is in the collection.
-
-
-
-
- Determines that the parameter collection is identical to the specified collection
-
-
-
-
- Determines that the parameter collection has the specified number of elements.
-
- The constraint that should be applied to the collection count.
-
-
-
- Determines that an element of the parameter collections conforms to another AbstractConstraint.
-
- The zero-based index of the list element.
- The constraint which should be applied to the list element.
-
-
-
- Determines that all elements of the specified collection are in the the parameter collection
-
- The collection to compare against
- The constraint which should be applied to the list parameter.
-
-
-
- Throws NotSupportedException. Don't use Equals to define constraints. Use Equal instead.
-
-
-
-
-
-
- Serves as a hash function for a particular type.
-
-
- A hash code for the current .
-
-
-
-
- Provides a dummy field to pass as out or ref argument.
-
-
-
-
-
- Dummy field to satisfy the compiler. Used for out and ref arguments.
-
-
-
-
- Central location for constraints for object's public fields
-
-
-
-
- Constrains the parameter to have a public field with the specified value
-
- Name of the public field.
- Expected value.
-
-
-
-
- Constrains the parameter to have a public field with the specified value.
-
- The type that declares the public field, used to disambiguate between public fields.
- Name of the public field.
- Expected value.
-
-
-
-
- Constrains the parameter to have a public field satisfying a specified constraint.
-
- Name of the public field.
- Constraint for the public field.
-
-
-
- Constrains the parameter to have a public field satisfying a specified constraint.
-
- The type that declares the public field, used to disambiguate between public fields.
- Name of the public field.
- Constraint for the public field.
-
-
-
- Determines whether the parameter has the specified public field and that it is null.
-
- Name of the public field.
-
-
-
-
- Determines whether the parameter has the specified public field and that it is null.
-
- The type that declares the public field, used to disambiguate between public fields.
- Name of the public field.
-
-
-
-
- Determines whether the parameter has the specified public field and that it is not null.
-
- Name of the public field.
-
-
-
-
- Determines whether the parameter has the specified public field and that it is not null.
-
- The type that declares the public field, used to disambiguate between public fields.
- Name of the public field.
-
-
-
-
- Central location for constraints
-
-
-
-
- Evaluate a greater than constraint for .
-
- The object the parameter should be greater than
-
-
-
- Evaluate a less than constraint for .
-
- The object the parameter should be less than
-
-
-
- Evaluate a less than or equal constraint for .
-
- The object the parameter should be less than or equal to
-
-
-
- Evaluate a greater than or equal constraint for .
-
- The object the parameter should be greater than or equal to
-
-
-
- Evaluate an equal constraint for .
-
- The object the parameter should equal to
-
-
-
- Evaluate a not equal constraint for .
-
- The object the parameter should not equal to
-
-
-
- Evaluate a same as constraint.
-
- The object the parameter should the same as.
-
-
-
- Evaluate a not same as constraint.
-
- The object the parameter should not be the same as.
-
-
-
- A constraints that accept anything
-
-
-
-
-
- A constraint that accept only nulls
-
-
-
-
-
- A constraint that accept only non null values
-
-
-
-
-
- A constraint that accept only value of the specified type
-
-
-
-
- A constraint that accept only value of the specified type
-
-
-
-
- Evaluate a parameter using a predicate
-
- The predicate to use
-
-
-
- Central location for constraints about lists and collections
-
-
-
-
- Determines whether the specified obj is in the parameter.
- The parameter must be IEnumerable.
-
- Obj.
-
-
-
-
- Determines whatever the parameter is in the collection.
-
-
-
-
- Determines that the parameter collection is identical to the specified collection
-
-
-
-
- Determines that the parameter collection has the specified number of elements.
-
- The constraint that should be applied to the collection count.
-
-
-
- Determines that an element of the parameter collections conforms to another AbstractConstraint.
-
- The zero-based index of the list element.
- The constraint which should be applied to the list element.
-
-
-
- Determines that an element of the parameter collections conforms to another AbstractConstraint.
-
- The key of the element.
- The constraint which should be applied to the element.
-
-
-
- Determines that all elements of the specified collection are in the the parameter collection
-
- The collection to compare against
- The constraint which should be applied to the list parameter.
-
-
-
- Central location for constraints for object's properties
-
-
-
-
- Constrains the parameter to have property with the specified value
-
- Name of the property.
- Expected value.
-
-
-
-
- Constrains the parameter to have property with the specified value.
-
- The type that declares the property, used to disambiguate between properties.
- Name of the property.
- Expected value.
-
-
-
-
- Constrains the parameter to have a property satisfying a specified constraint.
-
- Name of the property.
- Constraint for the property.
-
-
-
- Constrains the parameter to have a property satisfying a specified constraint.
-
- The type that declares the property, used to disambiguate between properties.
- Name of the property.
- Constraint for the property.
-
-
-
- Determines whether the parameter has the specified property and that it is null.
-
- Name of the property.
-
-
-
-
- Determines whether the parameter has the specified property and that it is null.
-
- The type that declares the property, used to disambiguate between properties.
- Name of the property.
-
-
-
-
- Determines whether the parameter has the specified property and that it is not null.
-
- Name of the property.
-
-
-
-
- Determines whether the parameter has the specified property and that it is not null.
-
- The type that declares the property, used to disambiguate between properties.
- Name of the property.
-
-
-
-
- constraints the parameter to have the exact same property values as the expected object.
-
- An object, of the same type as the parameter, whose properties are set with the expected values.
- An instance of the constraint that will do the actual check.
-
- The parameter's public property values and public field values will be matched against the expected object's
- public property values and public field values. The first mismatch will be reported and no further matching is done.
- The matching is recursive for any property or field that has properties or fields of it's own.
- Collections are supported through IEnumerable, which means the constraint will check if the actual and expected
- collection contain the same values in the same order, where the values contained by the collection can have properties
- and fields of their own that will be checked as well because of the recursive nature of this constraint.
-
-
-
-
- Central location for all text related constraints
-
-
-
-
- Constrain the argument to starts with the specified string
-
-
-
-
- Constrain the argument to end with the specified string
-
-
-
-
- Constrain the argument to contain the specified string
-
-
-
-
- Constrain the argument to validate according to regex pattern
-
-
-
-
- Provides access to the constraintes defined in the class to be used in context
- with the syntax.
-
-
-
-
- Constrain the argument to starts with the specified string
-
-
-
-
-
- Constrain the argument to end with the specified string
-
-
-
-
- Constrain the argument to contain the specified string
-
-
-
-
- Constrain the argument to validate according to regex pattern
-
-
-
-
- Throws NotSupportedException. Don't use Equals to define constraints. Use Equal instead.
-
-
-
-
-
-
- Serves as a hash function for a particular type.
-
-
- A hash code for the current .
-
-
-
-
- This class defines a lot of method signatures, which we will use
- to allow compatability on net-2.0
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- dummy
-
-
-
-
- Allows expectations to be set on methods that should never be called.
- For methods with void return value, you need to use LastCall or
- DoNotExpect.Call() with a delegate.
-
-
-
-
- Sets LastCall.Repeat.Never() on /any/ proxy on /any/ repository on the current thread.
- This method if not safe for multi threading scenarios.
-
-
-
-
- Accepts a delegate that will execute inside the method which
- LastCall.Repeat.Never() will be applied to.
- It is expected to be used with anonymous delegates / lambda expressions and only one
- method should be called.
-
-
- IService mockSrv = mocks.CreateMock(typeof(IService)) as IService;
- DoNotExpect.Call(delegate{ mockSrv.Stop(); });
- ...
-
-
-
-
- An expectaton violation was detected.
-
-
-
-
- Creates a new instance.
-
- Message.
-
-
-
- Serialization constructor
-
-
-
-
- Signals that an object was call on a mock repository which doesn't
- belong to this mock repository or not a mock
-
-
-
-
- Creates a new instance.
-
- Message.
-
-
-
- Serialization constructor
-
-
-
-
- Allows to set expectation on methods that has return values.
- For methods with void return value, you need to use LastCall
-
-
-
-
- The method options for the last call on /any/ proxy on /any/ repository on the current thread.
- This method if not safe for multi threading scenarios, use .
-
-
-
-
- Accepts a delegate that will execute inside the method, and then return the resulting
- instance.
- It is expected to be used with anonymous delegates / lambda expressions and only one
- method should be called.
-
-
- IService mockSrv = mocks.CreateMock(typeof(IService)) as IService;
- Expect.Call(delegate{ mockSrv.Start(); }).Throw(new NetworkException());
- ...
-
-
-
-
- Get the method options for the last method call on the mockInstance.
-
-
-
-
- A delegate that can be used to get better syntax on Expect.Call(delegate { foo.DoSomething(); });
-
-
-
-
- Abstract class that holds common information for
- expectations.
-
-
-
-
- Interface to validate that a method call is correct.
-
-
-
-
- Validate the arguments for the method.
- This method can be called numerous times, so be careful about side effects
-
- The arguments with which the method was called
-
-
-
- Add an actual method call to this expectation
-
-
-
-
- Returns the return value or throw the exception and setup any output / ref parameters
- that has been set.
-
-
-
-
- Builds the verification failure message.
-
-
-
-
-
- Gets the error message.
-
-
-
-
-
- Range of expected calls
-
-
-
-
- Number of call actually made for this method
-
-
-
-
- If this expectation is still waiting for calls.
-
-
-
-
- The return value for a method matching this expectation
-
-
-
-
- Gets or sets the exception to throw on a method matching this expectation.
-
-
-
-
- Gets a value indicating whether this instance's action is staisfied.
- A staisfied instance means that there are no more requirements from
- this method. A method with non void return value must register either
- a return value or an exception to throw.
-
-
-
-
- Gets the method this expectation is for.
-
-
-
-
- Gets or sets what special condtions there are for this method
- repeating.
-
-
-
-
- Gets a value indicating whether this expectation was satisfied
-
-
-
-
- Specify whatever this expectation has a return value set
- You can't check ReturnValue for this because a valid return value include null.
-
-
-
-
- An action to execute when the method is matched.
-
-
-
-
- Set the out / ref parameters for the method call.
- The indexing is zero based and ignores any non out/ref parameter.
- It is possible not to pass all the parameters. This method can be called only once.
-
-
-
-
- Documentation Message
-
-
-
-
- Gets the invocation for this expectation
-
- The invocation.
-
-
-
- Occurs when the exceptation is match on a method call
-
-
-
-
- Allow to set the return value in the future, if it was already set.
-
-
-
-
- Number of actuall calls made that passed this expectation
-
-
-
-
- Range of expected calls that should pass this expectation.
-
-
-
-
- The return value for a method matching this expectation
-
-
-
-
- The exception to throw on a method matching this expectation.
-
-
-
-
- The method this expectation is for.
-
-
-
-
- The return value for this method was set
-
-
-
-
- Whether this method will repeat
- unlimited number of times.
-
-
-
-
- A delegate that will be run when the
- expectation is matched.
-
-
-
-
- The arguments that matched this expectation.
-
-
-
-
- Documentation message
-
-
-
-
- The method originalInvocation
-
-
-
-
- Get the hash code
-
-
-
-
- Add an actual actualMethodCall call to this expectation
-
-
-
-
- Builds the verification failure message.
-
-
-
-
-
- Returns the return value or throw the exception and setup output / ref parameters
-
-
-
-
- Validate the arguments for the method on the child methods
-
- The arguments with which the method was called
-
-
-
- Creates a new instance.
-
- The originalInvocation for this method, required because it contains the generic type infromation
- Number of method calls for this expectations
-
-
-
- Creates a new instance.
-
- Expectation.
-
-
-
- Validate the arguments for the method on the child methods
-
- The arguments with which the method was called
-
-
-
- Determines if this object equal to obj
-
-
-
-
- The error message for these arguments
-
-
-
-
- Asserts that the delegate has the same parameters as the expectation's method call
-
-
-
-
- Setter for the outpur / ref parameters for this expecataion.
- Can only be set once.
-
-
-
-
- Specify whether this expectation has a return value set
- You can't check ReturnValue for this because a valid return value include null.
-
-
-
-
- Gets the method this expectation is for.
-
-
-
-
- Gets the originalInvocation for this expectation
-
- The originalInvocation.
-
-
-
- Gets or sets what special condtions there are for this method
-
-
-
-
- Range of expected calls
-
-
-
-
- Number of call actually made for this method
-
-
-
-
- If this expectation is still waiting for calls.
-
-
-
-
- Gets a value indicating whether this expectation was satisfied
-
-
-
-
- The return value for a method matching this expectation
-
-
-
-
- An action to execute when the method is matched.
-
-
-
-
- Gets or sets the exception to throw on a method matching this expectation.
-
-
-
-
- Gets a value indicating whether this instance's action is staisfied.
- A staisfied instance means that there are no more requirements from
- this method. A method with non void return value must register either
- a return value or an exception to throw or an action to execute.
-
-
-
-
- Documentation message
-
-
-
-
- Occurs when the exceptation is match on a method call
-
-
-
-
- Allow to set the return value in the future, if it was already set.
-
-
-
-
- Gets the error message.
-
-
-
-
-
- Expectation that matches any arguments for the method.
-
-
-
-
- Creates a new instance.
-
- Invocation for this expectation
- Number of method calls for this expectations
-
-
-
- Creates a new instance.
-
- Expectation.
-
-
-
- Validate the arguments for the method.
-
- The arguments with which the method was called
-
-
-
- Determines if the object equal to expectation
-
-
-
-
- Get the hash code
-
-
-
-
- Gets the error message.
-
-
-
-
-
- Summary description for ArgsEqualExpectation.
-
-
-
-
- Creates a new instance.
-
- Expected args.
- The invocation for this expectation
- Number of method calls for this expectations
-
-
-
- Validate the arguments for the method.
-
- The arguments with which the method was called
-
-
-
- Determines if the object equal to expectation
-
-
-
-
- Get the hash code
-
-
-
-
- Gets the error message.
-
-
-
-
-
- Get the expected args.
-
-
-
-
- Call a specified callback to verify the expectation
-
-
-
-
- Creates a new instance.
-
- Expectation.
- Callback.
-
-
-
- Creates a new instance.
-
- Invocation for this expectation
- Callback.
- Number of method calls for this expectations
-
-
-
- Validate the arguments for the method on the child methods
-
- The arguments with which the method was called
-
-
-
- Determines if the object equal to expectation
-
-
-
-
- Get the hash code
-
-
-
-
- Gets the error message.
-
-
-
-
-
- Expect the method's arguments to match the contraints
-
-
-
-
- Creates a new instance.
-
- Invocation for this expectation
- Constraints.
- Number of method calls for this expectations
-
-
-
- Creates a new instance.
-
- Expectation.
- Constraints.
-
-
-
- Validate the arguments for the method.
-
- The arguments with which the method was called
-
-
-
- Determines if the object equal to expectation
-
-
-
-
- Get the hash code
-
-
-
-
- Gets the error message.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Summary for AndSpecification
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Summary description for FollowsEventNamingStandard
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Summary descritpion for NamedEventExistsOnDeclaringType
-
-
-
-
-
-
-
-
- Doesn't log anything, just makes happy noises
-
-
-
-
- Log expectations - allows to see what is going on inside Rhino Mocks
-
-
-
-
- Logs the expectation as is was recorded
-
- The invocation.
- The expectation.
-
-
-
- Logs the expectation as it was recorded
-
- The invocation.
- The expectation.
-
-
-
- Logs the unexpected method call.
-
- The invocation.
- The message.
-
-
-
- Logs the expectation as is was recorded
-
- The invocation.
- The expectation.
-
-
-
- Logs the expectation as it was recorded
-
- The invocation.
- The expectation.
-
-
-
- Logs the unexpected method call.
-
- The invocation.
- The message.
-
-
-
- Operation on a remoting proxy
-
-
- It is not possible to directly communicate to a real proxy via transparent proxy.
- Transparent proxy impersonates a user type and only methods of that user type are callable.
- The only methods that are guaranteed to exist on any transparent proxy are methods defined
- in Object: namely ToString(), GetHashCode(), and Equals()).
-
- These three methods are the only way to tell the real proxy to do something.
- Equals() is the most suitable of all, since it accepts an arbitrary object parameter.
- The RemotingProxy code is built so that if it is compared to an IRemotingProxyOperation,
- transparentProxy.Equals(operation) will call operation.Process(realProxy).
- This way we can retrieve a real proxy from transparent proxy and perform
- arbitrary operation on it.
-
-
-
-
- Generates remoting proxies and provides utility functions
-
-
-
-
- Create the proxy using remoting
-
-
-
-
- Check whether an object is a transparent proxy with a RemotingProxy behind it
-
- Object to check
- true if the object is a transparent proxy with a RemotingProxy instance behind it, false otherwise
- We use Equals() method to communicate with the real proxy behind the object.
- See IRemotingProxyOperation for more details
-
-
-
- Retrieve a mocked object from a transparent proxy
-
- Transparent proxy with a RemotingProxy instance behind it
- Mocked object associated with the proxy
- We use Equals() method to communicate with the real proxy behind the object.
- See IRemotingProxyOperation for more details
-
-
-
- Implementation of IInvocation based on remoting proxy
-
- Some methods are marked NotSupported since they either don't make sense
- for remoting proxies, or they are never called by Rhino Mocks
-
-
-
- Rudimetry implementation that simply logs methods calls as text.
-
-
-
-
- Initializes a new instance of the class.
-
- The writer.
-
-
-
- Logs the expectation as it was recorded
-
- The invocation.
- The expectation.
-
-
-
- Logs the expectation as it was recorded
-
- The invocation.
- The expectation.
-
-
-
- Logs the unexpected method call.
-
- The invocation.
- The message.
-
-
-
- Behave like a stub, all properties and events acts normally, methods calls
- return default values by default (but can use expectations to set them up), etc.
-
-
-
-
- Records all the expectations for a mock
-
-
-
-
- Different actions on this mock
-
-
-
-
- Add a method call for this state' mock.
-
- The invocation for this method
- The method that was called
- The arguments this method was called with
-
-
-
- Verify that this mock expectations have passed.
-
-
-
-
- Verify that we can move to replay state and move
- to the reply state.
-
-
-
-
- Gets a mock state that match the original mock state of the object.
-
-
-
-
- Get the options for the last method call
-
-
-
-
- Set the exception to throw when Verify is called.
- This is used to report exception that may have happened but where caught in the code.
- This way, they are reported anyway when Verify() is called.
-
-
-
-
- This method is called to indicate that a property behavior call.
- This is done so we generate good error message in the common case of people using
- Stubbed properties with Return().
-
-
-
-
- Gets the matching verify state for this state
-
-
-
-
- Get the options for the last method call
-
-
-
-
- Get the options for the last method call
-
-
-
-
- Set the exception to throw when Verify is called.
- This is used to report exception that may have happened but where caught in the code.
- This way, they are reported anyway when Verify() is called.
-
-
-
-
- This method is called to indicate that a property behavior call.
- This is done so we generate good error message in the common case of people using
- Stubbed properties with Return().
-
-
-
-
- Creates a new instance.
-
- Repository.
- The proxy that generates the method calls
-
-
-
- Add a method call for this state' mock.
-
- The invocation for this method
- The method that was called
- The arguments this method was called with
-
-
-
- Verify that we can move to replay state and move
- to the reply state.
-
-
-
-
- Verify that we can move to replay state and move
- to the reply state.
-
-
-
-
- Verify that this mock expectations have passed.
-
-
-
-
- Gets a mock state that match the original mock state of the object.
-
-
-
-
- Asserts the previous method is closed (had an expectation set on it so we can replay it correctly)
-
-
-
-
- Get the default call count range expectation
-
-
-
-
-
- Gets the last expectation.
-
-
-
-
- Gets the total method calls count.
-
-
-
-
- Get the options for the last method call
-
-
-
-
- Gets the matching verify state for this state
-
-
-
-
- Initializes a new instance of the class.
-
- The proxy that generates the method calls
- Repository.
-
-
-
- We don't care much about expectations here, so we will remove the expectation if
- it is not closed.
-
-
-
-
- Verify that we can move to replay state and move
- to the reply state.
-
-
-
-
-
- Get the default call count range expectation
-
-
-
-
-
- Validate expectations on recorded methods, but in general completely ignoring them.
- Similar to except that it would return a
- when BackToRecord is called.
-
-
-
-
- Validate all expectations on a mock
-
-
-
-
- The repository for this state
-
-
-
-
- The proxy object for this state
-
-
-
-
- Get the options for the last method call
-
-
-
-
- Creates a new instance.
-
- The previous state for this method
-
-
-
- Add a method call for this state' mock.
-
- The invocation for this method
- The method that was called
- The arguments this method was called with
-
-
-
- Add a method call for this state' mock.
- This allows derived method to cleanly get a the setupresult behavior while adding
- their own.
-
- The invocation for this method
- The method that was called
- The arguments this method was called with
-
-
-
- Set the exception to throw when Verify is called.
- This is used to report exception that may have happened but where caught in the code.
- This way, they are reported anyway when Verify() is called.
-
-
-
-
- not relevant
-
-
-
-
- Verify that this mock expectations have passed.
-
-
-
-
- Verify that we can move to replay state and move
- to the reply state.
-
-
-
-
- Gets a mock state that match the original mock state of the object.
-
-
-
-
- Get the options for the last method call
-
-
-
-
- Gets the matching verify state for this state
-
-
-
-
- Initializes a new instance of the class.
-
- The previous state for this method
-
-
-
- Add a method call for this state' mock.
-
- The invocation for this method
- The method that was called
- The arguments this method was called with
-
-
-
- Gets a mock state that matches the original mock state of the object.
-
-
-
-
- Write rhino mocks log info to the trace
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- if set to true [log recorded].
- if set to true [log replayed].
- if set to true [log unexpected].
-
-
-
- Logs the expectation as is was recorded
-
- The invocation.
- The expectation.
-
-
-
- Logs the expectation as it was recorded
-
- The invocation.
- The expectation.
-
-
-
- Logs the unexpected method call.
-
- The invocation.
- The message.
-
-
-
- Writes log information as stack traces about rhino mocks activity
-
-
-
-
- Allows to redirect output to a different location.
-
-
-
-
- Logs the expectation as is was recorded
-
- The invocation.
- The expectation.
-
-
-
- Logs the expectation as it was recorded
-
- The invocation.
- The expectation.
-
-
-
- Logs the unexpected method call.
-
- The invocation.
- The message.
-
-
-
- Marker interface used to indicate that this is a partial mock.
-
-
-
-
- Options for CallOriginalMethod
-
-
-
-
- No expectation is created, the method will be called directly
-
-
-
-
- Normal expectation is created, but when the method is later called, it will also call the original method
-
-
-
-
- This is a data structure that is used by
- to pass
- the current method to the relevant delegate
-
-
-
-
- Initializes a new instance of the class.
-
- The invocation.
-
-
-
- Gets the args for this method invocation
-
-
-
-
- Get the method that was caused this invocation
-
-
-
-
- Gets or sets the return value for this method invocation
-
- The return value.
-
-
-
- Adds optional new usage:
- using(mockRepository.Record()) {
- Expect.Call(mock.Method()).Return(retVal);
- }
- using(mockRepository.Playback()) {
- // Execute code
- }
- N.B. mockRepository.ReplayAll() and mockRepository.VerifyAll()
- calls are taken care of by Record/Playback
-
-
- Creates proxied instances of types.
-
-
-
- Generates a stub without needing a
- Arguments for 's constructor
- The of stub to create.
- The stub
-
-
-
- Generates a stub without needing a
- The of stub.
- Arguments for the 's constructor.
- The stub
-
-
-
- Generate a mock object without needing a
- type of mock object to create.
- Arguments for 's constructor
- the mock object
-
-
-
- Generate a multi-mock object without needing a
- The typeof object to generate a mock for.
- A second interface to generate a multi-mock for.
- Arguments for 's constructor
- the multi-mock object
-
-
-
- Generate a multi-mock object without without needing a
- The typeof object to generate a mock for.
- An interface to generate a multi-mock for.
- A second interface to generate a multi-mock for.
- Arguments for 's constructor
- the multi-mock object
-
-
-
- Creates a multi-mock without without needing a
- The type of mock to create, this can be a class
- Any extra interfaces to add to the multi-mock, these can only be interfaces.
- Arguments for 's constructor
- the multi-mock object
-
-
-
- Creates a strict mock without without needing a
- Any arguments required for the 's constructor
- The type of mock object to create.
- The mock object with strict replay semantics
-
-
-
- Creates a strict multi-mock without needing a
- Any arguments required for the 's constructor
- The type of mock object to create, this can be a class.
- An interface to generate a multi-mock for, this must be an interface!
- The multi-mock object with strict replay semantics
-
-
-
- Creates a strict multi-mock without needing a
- Any arguments required for the 's constructor
- The type of mock object to create, this can be a class.
- An interface to generate a multi-mock for, this must be an interface!
- A second interface to generate a multi-mock for, this must be an interface!
- The multi-mock object with strict replay semantics
-
-
-
- Creates a strict multi-mock without needing a
- The type of mock object to create, this can be a class
- Any extra interfaces to generate a multi-mock for, these must be interaces!
- Any arguments for the 's constructor
- The strict multi-mock object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Generate a mock object with dynamic replay semantics and remoting without needing the mock repository
-
-
-
-
- Generate a mock object with strict replay semantics and remoting without needing the mock repository
-
-
-
- Helper method to create a mock object without a repository instance and put the object back into replay mode.
- The type of mock object to create
- A delegate that uses a mock repository instance to create the underlying mock
- The mock object in the replay mode.
-
-
-
-
-
-
-
-
-
-
-
-
-
- This is a map of types to ProxyGenerators.
-
-
-
-
- This is used to record the last repository that has a method called on it.
-
-
-
-
- this is used to get to the last proxy on this repository.
-
-
-
-
- For mock delegates, maps the proxy instance from intercepted invocations
- back to the delegate that was originally returned to client code, if any.
-
-
-
-
- All the proxies in the mock repositories
-
-
-
-
- This is here because we can't put it in any of the recorders, since repeatable methods
- have no orderring, and if we try to handle them using the usual manner, we would get into
- wierd situations where repeatable method that was defined in an orderring block doesn't
- exists until we enter this block.
-
-
-
-
- Creates a new instance.
-
-
-
-
- Move the repository to ordered mode
-
-
-
-
- Move the repository to un-ordered mode
-
-
-
-
- Creates a mock for the specified type.
-
- Type.
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Creates a strict mock for the specified type.
-
- Type.
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Creates a remoting mock for the specified type.
-
- Type.
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Creates a strict remoting mock for the specified type.
-
- Type.
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Creates a remoting mock for the specified type.
-
-
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
-
- Creates a strict remoting mock for the specified type.
-
-
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
-
- Creates a mock from several types, with strict semantics.
- Only may be a class.
-
-
-
-
- Creates a strict mock from several types, with strict semantics.
- Only may be a class.
-
-
-
-
- Creates a mock from several types, with strict semantics.
- Only may be a class.
-
- The main type to mock.
- Extra interface types to mock.
- Arguments for the class' constructor, if mocking a concrete class.
-
-
-
- Creates a strict mock from several types, with strict semantics.
- Only may be a class.
-
- The main type to mock.
- Extra interface types to mock.
- Arguments for the class' constructor, if mocking a concrete class.
-
-
-
- Creates a mock from several types, with dynamic semantics.
- Only may be a class.
-
- The main type to mock.
- Extra interface types to mock.
-
-
-
- Creates a mock from several types, with dynamic semantics.
- Only may be a class.
-
- The main type to mock.
- Extra interface types to mock.
- Arguments for the class' constructor, if mocking a concrete class.
-
-
- Creates a dynamic mock for the specified type.
- Type.
- Arguments for the class' constructor, if mocking a concrete class
-
-
- Creates a dynamic mock for the specified type.
- Type.
- Arguments for the class' constructor, if mocking a concrete class
-
-
- Creates a dynamic mock for the specified type.
-
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Creates a mock object that defaults to calling the class methods if no expectation is set on the method.
- Type.
- Arguments for the class' constructor.
-
-
- Creates a mock object that defaults to calling the class methods.
- Type.
- Extra interface types to mock.
-
-
- Creates a mock object that defaults to calling the class methods.
- Type.
- Extra interface types to mock.
- Arguments for the class' constructor.
-
-
- Creates a mock object using remoting proxies
- Type to mock - must be MarshalByRefObject
- Mock object
- Proxy mock can mock non-virtual methods, but not static methods
- Creates the mock state for this proxy
-
-
-
- Cause the mock state to change to replay, any further call is compared to the
- ones that were called in the record state.
-
- This method *cannot* be called from inside an ordering.
- the object to move to replay state
-
-
-
- Cause the mock state to change to replay, any further call is compared to the
- ones that were called in the record state.
-
- the object to move to replay state
-
-
-
- Move the mocked object back to record state.You can (and it's recommended) to run {Verify()} before you use this method.
- Will delete all current expectations!
-
-
-
- Move the mocked object back to record state.
- Optionally, can delete all current expectations, but allows more granularity about how
- it would behave with regard to the object state.
-
-
-
-
- Verify that all the expectations for this object were fulfilled.
-
- the object to verify the expectations for
-
-
-
- Get the method options for the last call on
- mockedInstance.
-
- The mock object
- Method options for the last call
-
-
-
- Maps an invocation proxy back to the mock object instance that was originally
- returned to client code which might have been a delegate to this proxy.
-
- The mock object proxy from the intercepted invocation
- The mock object
-
-
- This is provided to allow advance extention functionality, where Rhino Mocks standard functionality is not enough.
- The type to mock
- Delegate that create the first state of the mocked object (usualy the record state).
- Additional types to be implemented, this can be only interfaces
- optional arguments for the constructor
-
-
-
-
- Method: GetMockedObject
- Get an IProxy from a mocked object instance, or throws if the
- object is not a mock object.
-
-
-
-
- Method: GetMockedObjectOrNull
- Get an IProxy from a mocked object instance, or null if the
- object is not a mock object.
-
-
-
- Pops the recorder.
-
-
- Pushes the recorder.
- New recorder.
-
-
-
- All the mock objects in this repository will be moved
- to record state.
-
-
-
-
- All the mock objects in this repository will be moved
- to record state.
-
-
-
-
- Replay all the mocks from this repository
-
-
-
-
- Verify all the mocks from this repository
-
-
-
-
- Gets the proxy generator for a specific type. Having a single ProxyGenerator
- with multiple types linearly degrades the performance so this implementation
- keeps one ProxyGenerator per type.
-
-
-
- Set the exception to be thrown when verified is called.
-
-
-
- Creates a mock for the spesified type with strict mocking semantics.
- Strict semantics means that any call that wasn't explicitly recorded is considered an error and would cause an exception to be thrown.
-
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Creates a mock for the spesified type with strict mocking semantics.
- Strict semantics means that any call that wasn't explicitly recorded is considered an error and would cause an exception to be thrown.
-
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Creates a dynamic mock for the specified type.
-
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Creates a mock object from several types.
-
-
-
-
- Creates a strict mock object from several types.
-
-
-
-
- Create a mock object from several types with dynamic semantics.
-
-
-
-
- Create a mock object from several types with partial semantics.
-
-
-
-
- Create a mock object from several types with strict semantics.
-
- Extra interface types to mock.
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Create a strict mock object from several types with strict semantics.
-
- Extra interface types to mock.
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Create a mock object from several types with dynamic semantics.
-
- Extra interface types to mock.
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Create a mock object from several types with partial semantics.
-
- Extra interface types to mock.
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Create a mock object with from a class that defaults to calling the class methods
-
- Arguments for the class' constructor, if mocking a concrete class
-
-
-
- Create a stub object, one that has properties and events ready for use, and
- can have methods called on it. It requires an explicit step in order to create
- an expectation for a stub.
-
- The arguments for constructor.
-
-
-
- Create a stub object, one that has properties and events ready for use, and
- can have methods called on it. It requires an explicit step in order to create
- an expectation for a stub.
-
- The type.
- The arguments for constructor.
- The stub
-
-
-
- Returns true if the passed mock is currently in replay mode.
-
- The mock to test.
- True if the mock is in replay mode, false otherwise.
-
-
-
- Determines whether the specified proxy is a stub.
-
- The proxy.
-
-
-
- Register a call on a prperty behavior
-
-
-
-
-
- Gets the recorder.
-
-
-
-
-
- Gets the replayer for this repository.
-
-
-
-
-
- Gets the last proxy which had a method call.
-
-
-
-
- Delegate: CreateMockState
- This is used internally to cleanly handle the creation of different
- RecordMockStates.
-
-
-
-
- A set of extension methods that adds Arrange Act Assert mode to Rhino Mocks
-
-
-
-
- Create an expectation on this mock for this action to occur
-
-
- The mock.
- The action.
-
-
-
-
- Reset all expectations on this mock object
-
-
- The mock.
-
-
-
- Reset the selected expectation on this mock object
-
-
- The mock.
- The options to reset the expectations on this mock.
-
-
-
- Cause the mock state to change to replay, any further call is compared to the
- ones that were called in the record state.
-
- the mocked object to move to replay state
-
-
-
- Gets the mock repository for this specificied mock object
-
-
- The mock.
-
-
-
-
- Create an expectation on this mock for this action to occur
-
-
-
- The mock.
- The action.
-
-
-
-
- Tell the mock object to perform a certain action when a matching
- method is called.
- Does not create an expectation for this method.
-
-
- The mock.
- The action.
-
-
-
-
- Tell the mock object to perform a certain action when a matching
- method is called.
- Does not create an expectation for this method.
-
-
-
- The mock.
- The action.
-
-
-
-
- Gets the arguments for calls made on this mock object and the method that was called
- in the action.
-
-
- The mock.
- The action.
-
-
- Here we will get all the arguments for all the calls made to DoSomething(int)
-
- var argsForCalls = foo54.GetArgumentsForCallsMadeOn(x => x.DoSomething(0))
-
-
-
-
-
- Gets the arguments for calls made on this mock object and the method that was called
- in the action and matches the given constraints
-
-
- The mock.
- The action.
- The setup constraints.
-
-
- Here we will get all the arguments for all the calls made to DoSomething(int)
-
- var argsForCalls = foo54.GetArgumentsForCallsMadeOn(x => x.DoSomething(0))
-
-
-
-
-
- Asserts that a particular method was called on this mock object
-
-
- The mock.
- The action.
-
-
-
- Asserts that a particular method was called on this mock object that match
- a particular constraint set.
-
-
- The mock.
- The action.
- The setup constraints.
-
-
-
- Asserts that a particular method was called on this mock object that match
- a particular constraint set.
-
-
- The mock.
- The action.
-
-
-
- Asserts that a particular method was called on this mock object that match
- a particular constraint set.
-
-
- The mock.
- The action.
- The setup constraints.
-
-
-
- Asserts that a particular method was NOT called on this mock object
-
-
- The mock.
- The action.
-
-
-
- Asserts that a particular method was NOT called on this mock object that match
- a particular constraint set.
-
-
- The mock.
- The action.
- The setup constraints.
-
-
-
- Asserts that a particular method was NOT called on this mock object
-
-
- The mock.
- The action.
-
-
-
- Asserts that a particular method was NOT called on this mock object
-
-
- The mock.
- The action.
- The setup constraints.
-
-
-
- Finds the approprite implementation type of this item.
- This is the class or an interface outside of the rhino mocks.
-
- The mocked obj.
-
-
-
-
- Verifies all expectations on this mock object
-
- The mock object.
-
-
-
- Gets the event raiser for the event that was called in the action passed
-
- The type of the event source.
- The mock object.
- The event subscription.
-
-
-
-
- Raise the specified event using the passed arguments.
- The even is extracted from the passed labmda
-
- The type of the event source.
- The mock object.
- The event subscription.
- The sender.
- The instance containing the event data.
-
-
-
- Raise the specified event using the passed arguments.
- The even is extracted from the passed labmda
-
- The type of the event source.
- The mock object.
- The event subscription.
- The args.
-
-
- TODO: Make this better! It currently breaks down when mocking classes or
- ABC's that call other virtual methods which are getting intercepted too. I wish
- we could just walk Expression{Action{Action{T}} to assert only a single
- method is being made.
-
- The workaround is to not call foo.AssertWasCalled .. rather foo.VerifyAllExpectations()
- The type of mock object
- The mock repository
- The actual mock object to assert expectations on.
-
-
-
- Fake type that disallow creating it.
- Should have been System.Type, but we can't use it.
-
-
-
-
- Utility class for dealing with messing generics scenarios.
-
-
-
-
- There are issues with trying to get this to work correctly with open generic types, since this is an edge case,
- I am letting the runtime handle it.
-
-
-
-
- Gets the real type, including de-constructing and constructing the type of generic
- methods parameters.
-
- The type.
- The invocation.
-
-
-
-
- Because we need to support complex types here (simple generics were handled above) we
- need to be aware of the following scenarios:
- List[T] and List[Foo[T]]
-
-
-
-
- ExpectationsList
-
-
-
-
- Dictionary
-
-
-
-
- Dictionary class
-
-
-
-
- Create a new instance of ProxyStateDictionary
-
-
-
-
- Allows to call a method and immediately get it's options.
-
-
-
-
- Interface to allow calling a method and immediately get it's options.
-
-
-
-
- Get the method options for the call
-
- The method call should go here, the return value is ignored
-
-
-
- Creates a new instance.
-
-
-
-
- Get the method options for the call
-
- The method call should go here, the return value is ignored
-
-
-
- Allows to call a method and immediately get it's options.
- Set the expected number for the call to Any()
-
-
-
-
- Creates a new instance.
-
- Proxy.
- Mocked instance.
-
-
-
- Get the method options for the call
-
- The method call should go here, the return value is ignored
-
-
-
- This class is reponsible for taking a delegate and creating a wrapper
- interface around it, so it can be mocked.
-
-
-
-
- The scope for all the delegate interfaces create by this mock repository.
-
-
-
-
- Gets a type with an "Invoke" method suitable for use as a target of the
- specified delegate type.
-
-
-
-
-
-
- Raise events for all subscribers for an event
-
-
-
-
- Raise events for all subscribers for an event
-
-
-
-
- Raise the event
-
-
-
-
- The most common form for the event handler signature
-
-
-
-
- Create an event raiser for the specified event on this instance.
-
-
-
-
- Creates a new instance of EventRaiser
-
-
-
-
- Raise the event
-
-
-
-
- The most common signature for events
- Here to allow intellisense to make better guesses about how
- it should suggest parameters.
-
-
-
-
- Allows to define what would happen when a method
- is called.
-
-
-
-
- Allows to define what would happen when a method
- is called.
-
-
-
-
- Set the return value for the method.
-
- The object the method will return
- IRepeat that defines how many times the method will return this value
-
-
-
- Allow to override this return value in the future
-
- IRepeat that defines how many times the method will return this value
-
-
-
- Throws the specified exception when the method is called.
-
- Exception to throw
-
-
-
- Ignores the arguments for this method. Any argument will be matched
- againt this method.
-
-
-
-
- Add constraints for the method's arguments.
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched
- and allow to optionally modify the invocation as needed
-
-
-
-
- Call the original method on the class, bypassing the mocking layers.
-
-
-
-
-
- Call the original method on the class, optionally bypassing the mocking layers.
-
-
-
-
-
- Use the property as a simple property, getting/setting the values without
- causing mock expectations.
-
-
-
-
- Expect last (property) call as property setting, ignore the argument given
-
-
-
-
-
- Expect last (property) call as property setting with a given argument.
-
-
-
-
-
-
- Get an event raiser for the last subscribed event.
-
-
-
-
- Set the parameter values for out and ref parameters.
- This is done using zero based indexing, and _ignoring_ any non out/ref parameter.
-
-
-
-
- Documentation message for the expectation
-
- Message
-
-
-
- Better syntax to define repeats.
-
-
-
-
- Allows to specify the number of time for method calls
-
-
-
-
- Repeat the method twice.
-
-
-
-
- Repeat the method once.
-
-
-
-
- Repeat the method at least once, then repeat as many time as it would like.
-
-
-
-
- Repeat the method any number of times.
- This has special affects in that this method would now ignore orderring.
-
-
-
-
- Set the range to repeat an action.
-
- Min.
- Max.
-
-
-
- Set the amount of times to repeat an action.
-
-
-
-
- This method must not appear in the replay state.
- This has special affects in that this method would now ignore orderring.
-
-
-
-
- Creates a new instance.
-
- the repository for this expectation
- the recorder for this proxy
- the proxy for this expectation
- Expectation.
-
-
-
- Add constraints for the method's arguments.
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Set the return value for the method.
-
- The object the method will return
- IRepeat that defines how many times the method will return this value
-
-
-
- Set the return value for the method, but allow to override this return value in the future
-
- IRepeat that defines how many times the method will return this value
-
-
-
- Throws the specified exception when the method is called.
-
- Exception to throw
-
-
-
- Ignores the arguments for this method. Any argument will be matched
- againt this method.
-
-
-
-
- Call the original method on the class, bypassing the mocking layers.
-
-
-
-
-
- Call the original method on the class, optionally bypassing the mocking layers
-
-
-
-
-
- Use the property as a simple property, getting/setting the values without
- causing mock expectations.
-
-
-
-
- Expect last (property) call as property setting, ignore the argument given
-
-
-
-
-
- Expect last (property) call as property setting with a given argument.
-
-
-
-
-
-
- Gets the event raiser for the last event
-
-
-
-
- Set the parameter values for out and ref parameters.
- This is done using zero based indexing, and _ignoring_ any non out/ref parameter.
-
-
-
-
- Repeat the method twice.
-
-
-
-
- Repeat the method once.
-
-
-
-
- Repeat the method at least once, then repeat as many time as it would like.
-
-
-
-
- This method must not appear in the replay state.
-
-
-
-
- Documentation message for the expectation
-
- Message
-
-
-
- Repeat the method any number of times.
-
-
-
-
- Set the range to repeat an action.
-
- Min.
- Max.
-
-
-
- Set the amount of times to repeat an action.
-
-
-
-
- Better syntax to define repeats.
-
-
-
-
- This class will provide hash code for hashtables without needing
- to call the GetHashCode() on the object, which may very well be mocked.
- This class has no state so it is a singelton to avoid creating a lot of objects
- that does the exact same thing. See flyweight patterns.
-
-
-
-
- Get the hash code for a proxy object without calling GetHashCode()
- on the object.
-
-
-
-
- Compares two instances of mocked objects
-
-
-
-
- Compare two mocked objects
-
-
-
-
- The next hash code value for a mock object.
- This is safe for multi threading.
-
-
-
-
- The sole instance of
-
-
-
-
- This is a dummy type that is used merely to give DynamicProxy the proxy instance that
- it needs to create IProxy's types.
-
-
-
-
- Interface to find the repository of a mocked object
-
-
-
-
- Return true if it should call the original method on the object
- instead of pass it to the message chain.
-
- The method to call
-
-
-
- Register a method to be called on the object directly
-
-
-
-
- Register a property on the object that will behave as a simple property
-
-
-
-
- Check if the method was registered as a property method.
-
-
-
-
- Do get/set on the property, according to need.
-
-
-
-
- Do add/remove on the event
-
-
-
-
- Get the subscribers of a spesific event
-
-
-
-
- Gets the declaring type of the method, taking into acccount the possible generic
- parameters that it was created with.
-
-
-
-
- Clears the state of the object, remove original calls, property behavior, subscribed events, etc.
-
-
-
-
- Get all the method calls arguments that were made against this object with the specificed
- method.
-
-
- Only method calls in replay mode are counted
-
-
-
-
- Records the method call
-
-
-
-
- Mocks that are tied to this mock lifestyle
-
-
-
-
- The unique hash code of this mock, which is not related
- to the value of the GetHashCode() call on the object.
-
-
-
-
- Gets the repository.
-
-
-
-
- Gets the implemented types by this mocked object
-
- The implemented.
-
-
-
- Gets or sets the constructor arguments.
-
- The constructor arguments.
-
-
-
- The mocked instance that this is representing
-
-
-
-
- Create a new instance of
-
-
-
-
- Return true if it should call the original method on the object
- instead of pass it to the message chain.
-
- The method to call
-
-
-
- Register a method to be called on the object directly
-
-
-
-
- Register a property on the object that will behave as a simple property
- Return true if there is already a value for the property
-
-
-
-
- Check if the method was registered as a property method.
-
-
-
-
- Do get/set on the property, according to need.
-
-
-
-
- Do add/remove on the event
-
-
-
-
- Get the subscribers of a spesific event
-
-
-
-
- Gets the declaring type of the method, taking into acccount the possible generic
- parameters that it was created with.
-
-
-
-
- Get all the method calls arguments that were made against this object with the specificed
- method.
-
-
-
-
- Only method calls in replay mode are counted
-
-
-
-
- Records the method call
-
-
-
-
-
-
- Clears the state of the object, remove original calls, property behavior, subscribed events, etc.
-
-
-
-
- Mocks that are tied to this mock lifestyle
-
-
-
-
- The unique hash code of this proxy, which is not related
- to the value of the GetHashCode() call on the object.
-
-
-
-
- Gets the repository.
-
-
-
-
- Gets or sets the constructor arguments.
-
- The constructor arguments.
-
-
-
- The mocked instance that this is representing
-
-
-
-
- Gets the implemented types by this mocked object
-
- The implemented.
-
-
-
- Range for expected method calls
-
-
-
-
- Creates a new instance.
-
- Min.
- Max.
-
-
-
- Return the string representation of this range.
-
-
-
-
- Gets or sets the min.
-
-
-
-
-
- Gets or sets the max.
-
-
-
-
-
- Records all the expectations for a mock and
- return a ReplayDynamicMockState when Replay()
- is called.
-
-
-
-
- Creates a new instance.
-
- Repository.
- The proxy that generates the method calls
-
-
-
- Verify that we can move to replay state and move
- to the reply state.
-
-
-
-
- Get the default call count range expectation
-
-
-
-
-
- Gets a mock state that match the original mock state of the object.
-
-
-
-
- Records all the expectations for a mock and
- return a ReplayPartialMockState when Replay()
- is called.
-
-
-
-
- Creates a new instance.
-
- Repository.
- The proxy that generates the method calls
-
-
-
- Verify that we can move to replay state and move
- to the reply state.
-
-
-
-
- Gets a mock state that matches the original mock state of the object.
-
-
-
-
- Options for special repeat option
-
-
-
-
- This method can be called only as many times as the IMethodOptions.Expect allows.
-
-
-
-
- This method should never be called
-
-
-
-
- This method can be call any number of times
-
-
-
-
- This method will call the original method
-
-
-
-
- This method will call the original method, bypassing the mocking layer
-
-
-
-
- This method will simulate simple property behavior
-
-
-
-
- Validate all expectations on a mock and ignores calls to
- any method that was not setup properly.
-
-
-
-
- Creates a new instance.
-
- The previous state for this method
-
-
-
- Add a method call for this state' mock.
-
- The invocation for this method
- The method that was called
- The arguments this method was called with
-
-
-
- Gets a mock state that match the original mock state of the object.
-
-
-
-
- Validate all expectations on a mock and ignores calls to
- any method that was not setup properly.
-
-
-
-
- Creates a new instance.
-
- The previous state for this method
-
-
-
- Add a method call for this state' mock.
-
- The invocation for this method
- The method that was called
- The arguments this method was called with
-
-
-
- Gets a mock state that match the original mock state of the object.
-
-
-
-
- Summary description for RhinoInterceptor.
-
-
-
-
- Creates a new instance.
-
-
-
-
- Intercept a method call and direct it to the repository.
-
-
-
-
- Validate arguments for methods
-
-
-
-
- Validate that the passed argument is not null.
-
- The object to validate
- The name of the argument
-
- If the obj is null, an ArgumentNullException with the passed name
- is thrown.
-
-
-
-
- Validate that the arguments are equal.
-
- Expected args.
- Actual Args.
-
-
-
- Validate that the two arguments are equals, including validation for
- when the arguments are collections, in which case it will validate their values.
-
-
-
-
- This method is safe for use even if any of the objects is a mocked object
- that override equals.
-
-
-
-
- Throw an object already verified when accessed
-
-
-
-
- Create a new instance of VerifiedMockState
-
- The previous mock state, used to get the initial record state
-
-
-
- Add a method call for this state' mock.
-
- The invocation for this method
- The method that was called
- The arguments this method was called with
-
-
-
- Verify that this mock expectations have passed.
-
-
-
-
- Verify that we can move to replay state and move
- to the reply state.
-
-
-
-
- Gets a mock state that match the original mock state of the object.
-
-
-
-
- Get the options for the last method call
-
-
-
-
- Set the exception to throw when Verify is called.
- This is used to report exception that may have happened but where caught in the code.
- This way, they are reported anyway when Verify() is called.
-
-
-
-
- not relevant
-
-
-
-
- Gets the matching verify state for this state
-
-
-
-
- Get the options for the last method call
-
-
-
-
- Records the actions on all the mocks created by a repository.
-
-
-
-
- Records the specified call with the specified args on the mocked object.
-
-
-
-
- Get the expectation for this method on this object with this arguments
-
-
-
-
- This check the methods that were setup using the SetupResult.For()
- or LastCall.Repeat.Any() and that bypass the whole expectation model.
-
-
-
-
- Gets the all expectations for a mocked object and method combination,
- regardless of the expected arguments / callbacks / contraints.
-
- Mocked object.
- Method.
- List of all relevant expectation
-
-
-
- Gets the all expectations for proxy.
-
- Mocked object.
- List of all relevant expectation
-
-
-
- Removes all the repeatable expectations for proxy.
-
- Mocked object.
-
-
-
- Replaces the old expectation with the new expectation for the specified proxy/method pair.
- This replace ALL expectations that equal to old expectations.
-
- Proxy.
- Method.
- Old expectation.
- New expectation.
-
-
-
- Adds the recorder and turn it into the active recorder.
-
- Recorder.
-
-
-
- Moves to previous recorder.
-
-
-
-
- Gets the recorded expectation or null.
-
-
-
-
- Gets the next expected calls string.
-
-
-
-
- Moves to parent recorder.
-
-
-
-
- Set the expectation so it can repeat any number of times.
-
-
-
-
- Removes the expectation from the recorder
-
-
-
-
- Clear the replayer to call (and all its chain of replayers)
- This also removes it from the list of expectations, so it will never be considered again
-
-
-
-
- Get the expectation for this method on this object with this arguments
-
-
-
-
- Gets a value indicating whether this instance has expectations that weren't satisfied yet.
-
-
- true if this instance has expectations; otherwise, false .
-
-
-
-
- Allows to set various options for the last method call on
- a specified object.
- If the method has a return value, it's recommended to use Expect
-
-
-
-
- Allows to get an interface to work on the last call.
-
- The mocked object
- Interface that allows to set options for the last method call on this object
-
-
-
- Set the return value for the method.
-
- The object the method will return
- IRepeat that defines how many times the method will return this value
-
-
-
- Set the return value for the method. This overload is needed for LastCall.Return(null)
-
- The object the method will return
- IRepeat that defines how many times the method will return this value
-
-
-
- Throws the specified exception when the method is called.
-
- Exception to throw
-
-
-
- Ignores the arguments for this method. Any argument will be matched
- againt this method.
-
-
-
-
- Add constraints for the method's arguments.
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Set a callback method for the last call
-
-
-
-
- Call the original method on the class, bypassing the mocking layers, for the last call.
-
-
-
-
- Call the original method on the class, optionally bypassing the mocking layers, for the last call.
-
-
-
-
- Set a delegate to be called when the expectation is matched.
- The delegate return value will be returned from the expectation.
-
-
-
-
- Gets an interface that will raise the last event when called.
-
-
-
-
- Set the parameter values for out and ref parameters.
- This is done using zero based indexing, and _ignoring_ any non out/ref parameter.
-
-
-
-
- Documentation message for the expectation
-
- Message
-
-
-
- Use the property as a simple property, getting/setting the values without
- causing mock expectations.
-
-
-
-
- Better syntax to define repeats.
-
-
-
-
- Base class for method recorders, handle delegating to inner recorder if needed.
-
-
-
-
- List of the expected actions on for this recorder
- The legal values are:
- * Expectations
- * Method Recorders
-
-
-
-
- The current recorder.
-
-
-
-
- The current replayer;
-
-
-
-
- The parent recorder of this one, may be null.
-
-
-
-
- This contains a list of all the replayers that should be ignored
- for a spesific method call. A replayer gets into this list by calling
- ClearReplayerToCall() on its parent. This list is Clear()ed on each new invocation.
-
-
-
-
- All the repeatable methods calls.
-
-
-
-
- Counts the recursion depth of the current expectation search stack
-
-
-
-
- Creates a new instance.
-
-
-
-
- Creates a new instance.
-
- Parent recorder.
- Repeatable methods
-
-
-
- Records the specified call with the specified args on the mocked object.
-
-
-
-
- Get the expectation for this method on this object with this arguments
-
-
-
-
- Gets the all expectations for a mocked object and method combination,
- regardless of the expected arguments / callbacks / contraints.
-
- Mocked object.
- Method.
- List of all relevant expectation
-
-
-
- Gets the all expectations for proxy.
-
- Mocked object.
- List of all relevant expectation
-
-
-
- Replaces the old expectation with the new expectation for the specified proxy/method pair.
- This replace ALL expectations that equal to old expectations.
-
- Proxy.
- Method.
- Old expectation.
- New expectation.
-
-
-
- Remove the all repeatable expectations for proxy.
-
- Mocked object.
-
-
-
- Set the expectation so it can repeat any number of times.
-
-
-
-
- Removes the expectation from the recorder
-
-
-
-
- Adds the recorder and turn it into the active recorder.
-
- Recorder.
-
-
-
- Moves to previous recorder.
-
-
-
-
- Moves to parent recorder.
-
-
-
-
- Gets the recorded expectation or null.
-
-
-
-
- Clear the replayer to call (and all its chain of replayers).
- This also removes it from the list of expectations, so it will never be considered again
-
-
-
-
- Get the expectation for this method on this object with this arguments
-
-
-
-
- Gets the next expected calls string.
-
-
-
-
- Handles the real getting of the recorded expectation or null.
-
-
-
-
- Handle the real execution of this method for the derived class
-
-
-
-
- Handle the real execution of this method for the derived class
-
-
-
-
- Handle the real execution of this method for the derived class
-
-
-
-
- Handle the real execution of this method for the derived class
-
-
-
-
- Handle the real execution of this method for the derived class
-
-
-
-
- Handle the real execution of this method for the derived class
-
-
-
-
- Should this replayer be considered valid for this call?
-
-
-
-
- This check the methods that were setup using the SetupResult.For()
- or LastCall.Repeat.Any() and that bypass the whole expectation model.
-
-
-
-
- Gets a value indicating whether this instance has expectations that weren't satisfied yet.
-
-
- true if this instance has expectations; otherwise, false .
-
-
-
-
- Handle the real execution of this method for the derived class
-
-
-
-
- Ordered collection of methods, methods must arrive in specified order
- in order to pass.
-
-
-
-
- Unordered collection of method records, any expectation that exist
- will be matched.
-
-
-
-
- The parent recorder we have redirected to.
- Useful for certain edge cases in orderring.
- See: FieldProblem_Entropy for the details.
-
-
-
-
- Creates a new instance.
-
- Parent recorder.
- Repeatable methods
-
-
-
- Creates a new instance.
-
-
-
-
- Records the specified call with the specified args on the mocked object.
-
- Mocked object.
- Method.
- Expectation.
-
-
-
- Get the expectation for this method on this object with this arguments
-
- Invocation for this method
- Mocked object.
- Method.
- Args.
- True is the call was recorded, false otherwise
-
-
-
- Gets the all expectations for a mocked object and method combination,
- regardless of the expected arguments / callbacks / contraints.
-
- Mocked object.
- Method.
- List of all relevant expectation
-
-
-
- Gets the all expectations for proxy.
-
- Mocked object.
- List of all relevant expectation
-
-
-
- Replaces the old expectation with the new expectation for the specified proxy/method pair.
- This replace ALL expectations that equal to old expectations.
-
- Proxy.
- Method.
- Old expectation.
- New expectation.
-
-
-
- Handle the real execution of this method for the derived class
-
-
-
-
- Handles the real getting of the recorded expectation or null.
-
-
-
-
- Handle the real execution of this method for the derived class
-
-
-
-
- Gets the next expected calls string.
-
-
-
-
- Create an exception for an unexpected method call.
-
-
-
-
- Gets a value indicating whether this instance has expectations that weren't satisfied yet.
-
-
- true if this instance has expectations; otherwise, false .
-
-
-
-
- Creates a new instance.
-
- Parent recorder.
- Repetable methods
-
-
-
- Creates a new instance.
-
-
-
-
- Handles the real getting of the recorded expectation or null.
-
-
-
-
- Get the expectation for this method on this object with this arguments
-
-
-
-
- Gets the next expected calls string.
-
-
-
-
- Hold an expectation for a method call on an object
-
-
-
-
- Creates a new instance.
-
- Proxy.
- Method.
- Expectation.
-
-
-
- Determines if the object equal to this instance
-
- Obj.
-
-
-
-
- Gets the hash code.
-
-
-
-
-
- Gets the proxy.
-
-
-
-
-
- Gets the method.
-
-
-
-
-
- Gets the expectation.
-
-
-
-
-
- Holds a pair of mocked object and a method
- and allows to compare them against each other.
- This allows us to have a distinction between mockOne.MyMethod() and
- mockTwo.MyMethod()...
-
-
-
-
- Creates a new instance.
-
- Proxy.
- Method.
-
-
-
- Determines whatever obj equals to this instance.
- ProxyMethodPairs are equal when they point to the same /instance/ of
- an object, and to the same method.
-
- Obj.
-
-
-
-
- Gets the hash code.
-
-
-
-
-
- Gets the proxy.
-
-
-
-
-
- Gets the method.
-
-
-
-
-
- Change the recorder from ordered to unordered and vice versa
-
-
-
-
- Creates a new instance.
-
-
-
-
- Disposes this instance.
-
-
-
-
- Accessor for the current mocker
-
-
-
-
- The current mocker
-
-
-
-
- Used for [assembly: InternalsVisibleTo(RhinoMocks.StrongName)]
- Used for [assembly: InternalsVisibleTo(RhinoMocks.NormalName)]
-
-
-
-
- Strong name for the Dynamic Proxy assemblies. Used for InternalsVisibleTo specification.
-
-
-
-
- Normal name for dynamic proxy assemblies. Used for InternalsVisibleTo specification.
-
-
-
-
- Logs all method calls for methods
-
-
-
-
- Setup method calls to repeat any number of times.
-
-
-
-
- Get the method options and set the last method call to repeat
- any number of times.
- This also means that the method would transcend ordering
-
-
-
-
- Get the method options for the last method call on the mockInstance and set it
- to repeat any number of times.
- This also means that the method would transcend ordering
-
-
-
-
- Utility class for working with method calls.
-
-
-
-
- Return the string representation of a method call and its arguments.
-
- The method
- The method arguments
- Invocation of the method, used to get the generics arguments
- Delegate to format the parameter
- The string representation of this method call
-
-
-
- Return the string representation of a method call and its arguments.
-
- The invocation of the method, used to get the generic parameters
- The method
- The method arguments
- The string representation of this method call
-
-
-
- Delegate to format the argument for the string representation of
- the method call.
-
-
-
-
- Utility to get the default value for a type
-
-
-
-
- The default value for a type.
- Null for reference types and void
- 0 for value types.
- First element for enums
- Note that we need to get the value even for opened generic types, such as those from
- generic methods.
-
- Type.
- The invocation.
- the default value
-
-
-
- Allows easier access to MockRepository, works closely with Mocker.Current to
- allow access to a context where the mock repository is automatially verified at
- the end of the code block.
-
-
-
-
- Initialize a code block where Mocker.Current is initialized.
- At the end of the code block, all the expectation will be verified.
- This overload will create a new MockRepository.
-
- The code that will be executed under the mock context
-
-
-
- Initialize a code block where Mocker.Current is initialized.
- At the end of the code block, all the expectation will be verified.
- This overload will create a new MockRepository.
-
- The mock repository to use, at the end of the code block, VerifyAll() will be called on the repository.
- The code that will be executed under the mock context
-
-
-
- Create a FluentMocker
-
- The mock repository to use.
-
-
-
- A method with no arguments and no return value that will be called under the mock context.
-
-
-
-
- FluentMocker implements some kind of fluent interface attempt
- for saying "With the Mocks [mocks], Expecting (in same order) [things] verify [that]."
-
-
-
-
- Interface to verify previously defined expectations
-
-
-
-
- Verifies if a piece of code
-
-
-
-
- Defines unordered expectations
-
- A delegate describing the expectations
- an IMockVerifier
-
-
-
- Defines ordered expectations
-
- A delegate describing the expectations
- an IMockVerifier
-
-
-
- Verifies previously defined expectations
-
-
-
-
- This delegate is compatible with the System.Func{T,R} signature
- We have to define our own to get compatability with 2.0
-
-
-
-
- This attribute is here so we can get better Pex integration
- Using this means that Pex will not try to inspect the work of
- the actual proxies being generated by Rhino Mocks
-
-
-
-
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index b14138642..b3ce936cf 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -31,8 +31,8 @@
en-US
True
- git
- https://github.com/spring-projects/spring-net
+ true
+ true
True
@@ -46,8 +46,13 @@
latest
+
+
+
+
+ Full
DEBUG;TRACE;DEBUG_DYNAMIC;$(DefineConstants)
diff --git a/src/Spring/Spring.Aop/Aop/Framework/AdvisorChainFactoryUtils.cs b/src/Spring/Spring.Aop/Aop/Framework/AdvisorChainFactoryUtils.cs
index d4ebd34ef..7f8c998b3 100644
--- a/src/Spring/Spring.Aop/Aop/Framework/AdvisorChainFactoryUtils.cs
+++ b/src/Spring/Spring.Aop/Aop/Framework/AdvisorChainFactoryUtils.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/Spring/Spring.Aop/Aop/Framework/AopContext.cs b/src/Spring/Spring.Aop/Aop/Framework/AopContext.cs
index 5954a361c..5c8cca18f 100644
--- a/src/Spring/Spring.Aop/Aop/Framework/AopContext.cs
+++ b/src/Spring/Spring.Aop/Aop/Framework/AopContext.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ namespace Spring.Aop.Framework
/// advice configuration.
///
///
- /// The default value for the
+ /// The default value for the
/// property
/// is , for performance reasons.
///
@@ -99,7 +99,7 @@ public static bool IsActive
{
get
{
- return (tls_ProxyStack != null && tls_ProxyStack.Count > 0);
+ return (tls_ProxyStack != null && tls_ProxyStack.Count > 0);
}
}
@@ -125,7 +125,7 @@ public static object CurrentProxy
}
///
///
diff --git a/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAutoProxyCreator.cs b/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAutoProxyCreator.cs
index 4e45a4934..02528ba00 100644
--- a/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAutoProxyCreator.cs
+++ b/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAutoProxyCreator.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -109,13 +109,13 @@ public abstract class AbstractAutoProxyCreator : ProxyConfig, IInstantiationAwar
/// Indicates whether to mark the create proxy as immutable.
///
///
- /// Setting this to true effectively disables modifying the generated
+ /// Setting this to true effectively disables modifying the generated
/// proxy's advisor configuration
///
private bool freezeProxy = false;
///
- /// Names of common interceptors.
+ /// Names of common interceptors.
/// We must use object name rather than object references
/// to handle prototype advisors/interceptors.
/// Default is the empty array: no common interceptors.
@@ -142,7 +142,7 @@ public abstract class AbstractAutoProxyCreator : ProxyConfig, IInstantiationAwar
#region Properties
///
- /// Sets the AdvisorAdapterRegistry to use.
+ /// Sets the AdvisorAdapterRegistry to use.
///
///
/// Default is the global AdvisorAdapterRegistry.
@@ -170,19 +170,19 @@ public IList CustomTargetSourceCreators
set { customTargetSourceCreators = value; }
}
- ///
- /// Sets the common interceptors, a list of ,
+ ///
+ /// Sets the common interceptors, a list of ,
/// and introduction object names.
///
///
///
- /// If this property isn't set, there will be zero common interceptors.
+ /// If this property isn't set, there will be zero common interceptors.
/// This is perfectly valid, if "specific" interceptors such as
/// matching Advisors are all we want.
///
///
///
- /// The list of ,
+ /// The list of ,
/// and introduction object names.
///
///
@@ -194,7 +194,7 @@ public string[] InterceptorNames
///
/// Sets whether the common interceptors should be applied before
- /// object-specific ones.
+ /// object-specific ones.
///
///
/// Default is true; else, object-specific interceptors will get applied first.
@@ -683,7 +683,7 @@ public bool PostProcessAfterInstantiation(object objectInstance, string objectNa
/// The property values that the factory is about to apply (never null).
/// he relevant property infos for the target object (with ignored
/// dependency types - which the factory handles specifically - already filtered out)
- /// The object instance created, but whose properties have not yet
+ /// The object instance created, but whose properties have not yet
/// been set.
/// Name of the object.
/// The passed in PropertyValues
diff --git a/src/Spring/Spring.Aop/Aop/Target/SimplePoolTargetSource.cs b/src/Spring/Spring.Aop/Aop/Target/SimplePoolTargetSource.cs
index 623150ae1..362265cda 100644
--- a/src/Spring/Spring.Aop/Aop/Target/SimplePoolTargetSource.cs
+++ b/src/Spring/Spring.Aop/Aop/Target/SimplePoolTargetSource.cs
@@ -2,13 +2,13 @@
/*
* Copyright © 2002-2011 the original author or authors.
-*
+*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
-*
+*
* http://www.apache.org/licenses/LICENSE-2.0
-*
+*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/src/Spring/Spring.Core/Context/Support/AbstractApplicationContext.cs b/src/Spring/Spring.Core/Context/Support/AbstractApplicationContext.cs
index aee150980..fc754a5c2 100644
--- a/src/Spring/Spring.Core/Context/Support/AbstractApplicationContext.cs
+++ b/src/Spring/Spring.Core/Context/Support/AbstractApplicationContext.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -236,7 +236,7 @@ protected AbstractApplicationContext(string name, bool caseSensitive,
/// processors being added to the underlying
///
///
- /// Each time is called on this context, the context ensures, that
+ /// Each time is called on this context, the context ensures, that
/// all default s are registered with the underlying .
///
/// The instance.
@@ -268,7 +268,7 @@ public virtual void Dispose()
#endregion
- // Closed event is raised before destroying objectfactory to enable registered IApplicationEventListeners
+ // Closed event is raised before destroying objectfactory to enable registered IApplicationEventListeners
// to handle the event before they get disposed.
PublishEvent(this, new ContextClosedEventArgs());
@@ -1046,7 +1046,7 @@ public void Refresh()
}
///
- /// Registers well-known s and
+ /// Registers well-known s and
/// preregisters well-known dependencies using
///
/// the raw object factory as returned from
@@ -1370,14 +1370,14 @@ public IList GetObjectDefinitionNames()
{
return GetObjectDefinitionNames(false);
}
-
+
///
/// Return the names of all objects defined in this factory, if includeAncestorsis true
/// includes all parent factories.
///
/// to include parent factories into result
///
- /// The names of all objects defined in this factory, if includeAncestors is true includes all
+ /// The names of all objects defined in this factory, if includeAncestors is true includes all
/// objects defined in parent factories, or an empty array if none are defined.
///
public IList GetObjectDefinitionNames(bool includeAncestors)
@@ -1401,7 +1401,7 @@ public IList GetObjectDefinitionNames(bool includeAncestors)
///
///
/// In the case of errors.
- ///
+ ///
public virtual IObjectDefinition GetObjectDefinition(string name)
{
return SafeGetObjectFactory().GetObjectDefinition(name);
@@ -1425,7 +1425,7 @@ public virtual IObjectDefinition GetObjectDefinition(string name)
///
///
/// In the case of errors.
- ///
+ ///
public IObjectDefinition GetObjectDefinition(string name, bool includeAncestors)
{
return SafeGetObjectFactory().GetObjectDefinition(name, includeAncestors);
@@ -2099,7 +2099,7 @@ public IObjectFactory ParentObjectFactory
/// of the given name from an ancestor object factory.
///
///
- ///
+ ///
///
/// The name of the object to query.
///
@@ -2115,8 +2115,8 @@ public bool ContainsLocalObject(string name)
#region IObjectDefinitionRegistry Members
///
- /// Determine whether the given object name is already in use within this context,
- /// i.e. whether there is a local object. May be override by subclasses, the default
+ /// Determine whether the given object name is already in use within this context,
+ /// i.e. whether there is a local object. May be override by subclasses, the default
/// implementation simply returns
///
public virtual bool IsObjectNameInUse(string objectName)
@@ -2496,7 +2496,7 @@ public void Unsubscribe(object subscriber, Type targetSourceType)
///
///
///
- ///
+ ///
///
///
///
diff --git a/src/Spring/Spring.Core/Expressions/LambdaExpressionNode.cs b/src/Spring/Spring.Core/Expressions/LambdaExpressionNode.cs
index 986871b37..bd5ee866a 100644
--- a/src/Spring/Spring.Core/Expressions/LambdaExpressionNode.cs
+++ b/src/Spring/Spring.Core/Expressions/LambdaExpressionNode.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public class LambdaExpressionNode : BaseNode
/// caches argumentNames of this instance
///
private string[] argumentNames;
-
+
///
/// caches body expression of this lambda function
///
@@ -56,7 +56,7 @@ protected LambdaExpressionNode(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
-
+
///
/// Gets argument names for this lambda expression.
///
@@ -107,7 +107,7 @@ protected override object Get(object context, EvaluationContext evalContext, obj
arguments[argNames[i]] = argValues[i];
}
- EvaluationContext ec = (EvaluationContext)evalContext;
+ EvaluationContext ec = evalContext;
using (ec.SwitchLocalVariables(arguments))
{
object result = Get(context, ec);
diff --git a/src/Spring/Spring.Core/Expressions/Parser/ExpressionParser.cs b/src/Spring/Spring.Core/Expressions/Parser/ExpressionParser.cs
index 202e41e3f..1124ebb53 100644
--- a/src/Spring/Spring.Core/Expressions/Parser/ExpressionParser.cs
+++ b/src/Spring/Spring.Core/Expressions/Parser/ExpressionParser.cs
@@ -4,7 +4,7 @@ namespace Spring.Expressions.Parser
{
// Generate the header common to all output files.
using System;
-
+
using TokenBuffer = antlr.TokenBuffer;
using Token = antlr.Token;
using TokenStream = antlr.TokenStream;
@@ -88,10 +88,10 @@ internal class ExpressionParser : antlr.LLkParser
public const int EXPONENT_PART = 69;
public const int SIGN = 70;
public const int REAL_TYPE_SUFFIX = 71;
-
-
+
+
// CLOVER:OFF
-
+
public override void reportError(RecognitionException ex)
{
//base.reportError(ex);
@@ -103,7 +103,7 @@ public override void reportError(string error)
//base.reportError(error);
throw new RecognitionException(error);
}
-
+
private string GetRelationalOperatorNodeType(string op)
{
switch (op)
@@ -119,48 +119,48 @@ private string GetRelationalOperatorNodeType(string op)
case "between" : return "Spring.Expressions.OpBetween";
case "like" : return "Spring.Expressions.OpLike";
case "matches" : return "Spring.Expressions.OpMatches";
- default :
+ default :
throw new ArgumentException("Node type for operator '" + op + "' is not defined.");
}
}
-
+
protected void initialize()
{
tokenNames = tokenNames_;
initializeFactory();
}
-
-
+
+
protected ExpressionParser(TokenBuffer tokenBuf, int k) : base(tokenBuf, k)
{
initialize();
}
-
+
public ExpressionParser(TokenBuffer tokenBuf) : this(tokenBuf,2)
{
}
-
+
protected ExpressionParser(TokenStream lexer, int k) : base(lexer,k)
{
initialize();
}
-
+
public ExpressionParser(TokenStream lexer) : this(lexer,2)
{
}
-
+
public ExpressionParser(ParserSharedInputState state) : base(state,2)
{
initialize();
}
-
+
public void expr() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST expr_AST = null;
-
+
try { // for error handling
expression();
if (0 == inputState.guessing)
@@ -184,14 +184,14 @@ public void expr() //throws RecognitionException, TokenStreamException
}
returnAST = expr_AST;
}
-
+
public void expression() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST expression_AST = null;
-
+
try { // for error handling
logicalOrExpression();
if (0 == inputState.guessing)
@@ -284,14 +284,14 @@ public void expression() //throws RecognitionException, TokenStreamException
}
returnAST = expression_AST;
}
-
+
public void exprList() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST exprList_AST = null;
-
+
try { // for error handling
match(LPAREN);
expression();
@@ -316,7 +316,7 @@ public void exprList() //throws RecognitionException, TokenStreamException
{
if (_cnt4 >= 1) { goto _loop4_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
}
-
+
_cnt4++;
}
_loop4_breakloop: ;
@@ -349,14 +349,14 @@ public void exprList() //throws RecognitionException, TokenStreamException
}
returnAST = exprList_AST;
}
-
+
public void logicalOrExpression() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST logicalOrExpression_AST = null;
-
+
try { // for error handling
logicalXorExpression();
if (0 == inputState.guessing)
@@ -382,7 +382,7 @@ public void logicalOrExpression() //throws RecognitionException, TokenStreamExce
{
goto _loop13_breakloop;
}
-
+
}
_loop13_breakloop: ;
} // ( ... )*
@@ -402,14 +402,14 @@ public void logicalOrExpression() //throws RecognitionException, TokenStreamExce
}
returnAST = logicalOrExpression_AST;
}
-
+
public void parenExpr() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST parenExpr_AST = null;
-
+
try { // for error handling
match(LPAREN);
expression();
@@ -434,14 +434,14 @@ public void parenExpr() //throws RecognitionException, TokenStreamException
}
returnAST = parenExpr_AST;
}
-
+
public void logicalXorExpression() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST logicalXorExpression_AST = null;
-
+
try { // for error handling
logicalAndExpression();
if (0 == inputState.guessing)
@@ -467,7 +467,7 @@ public void logicalXorExpression() //throws RecognitionException, TokenStreamExc
{
goto _loop16_breakloop;
}
-
+
}
_loop16_breakloop: ;
} // ( ... )*
@@ -487,14 +487,14 @@ public void logicalXorExpression() //throws RecognitionException, TokenStreamExc
}
returnAST = logicalXorExpression_AST;
}
-
+
public void logicalAndExpression() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST logicalAndExpression_AST = null;
-
+
try { // for error handling
relationalExpression();
if (0 == inputState.guessing)
@@ -520,7 +520,7 @@ public void logicalAndExpression() //throws RecognitionException, TokenStreamExc
{
goto _loop19_breakloop;
}
-
+
}
_loop19_breakloop: ;
} // ( ... )*
@@ -540,17 +540,17 @@ public void logicalAndExpression() //throws RecognitionException, TokenStreamExc
}
returnAST = logicalAndExpression_AST;
}
-
+
public void relationalExpression() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST relationalExpression_AST = null;
Spring.Expressions.SpringAST e1_AST = null;
Spring.Expressions.SpringAST op_AST = null;
Spring.Expressions.SpringAST e2_AST = null;
-
+
try { // for error handling
sumExpr();
if (0 == inputState.guessing)
@@ -590,7 +590,7 @@ public void relationalExpression() //throws RecognitionException, TokenStreamExc
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
relationalExpression_AST = (Spring.Expressions.SpringAST)currentAST.root;
}
@@ -608,14 +608,14 @@ public void relationalExpression() //throws RecognitionException, TokenStreamExc
}
returnAST = relationalExpression_AST;
}
-
+
public void sumExpr() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST sumExpr_AST = null;
-
+
try { // for error handling
prodExpr();
if (0 == inputState.guessing)
@@ -645,7 +645,7 @@ public void sumExpr() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
prodExpr();
if (0 == inputState.guessing)
@@ -657,7 +657,7 @@ public void sumExpr() //throws RecognitionException, TokenStreamException
{
goto _loop25_breakloop;
}
-
+
}
_loop25_breakloop: ;
} // ( ... )*
@@ -677,14 +677,14 @@ public void sumExpr() //throws RecognitionException, TokenStreamException
}
returnAST = sumExpr_AST;
}
-
+
public void relationalOperator() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST relationalOperator_AST = null;
-
+
try { // for error handling
switch ( LA(1) )
{
@@ -807,14 +807,14 @@ public void relationalOperator() //throws RecognitionException, TokenStreamExcep
}
returnAST = relationalOperator_AST;
}
-
+
public void prodExpr() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST prodExpr_AST = null;
-
+
try { // for error handling
powExpr();
if (0 == inputState.guessing)
@@ -869,7 +869,7 @@ public void prodExpr() //throws RecognitionException, TokenStreamException
{
goto _loop29_breakloop;
}
-
+
}
_loop29_breakloop: ;
} // ( ... )*
@@ -889,14 +889,14 @@ public void prodExpr() //throws RecognitionException, TokenStreamException
}
returnAST = prodExpr_AST;
}
-
+
public void powExpr() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST powExpr_AST = null;
-
+
try { // for error handling
unaryExpression();
if (0 == inputState.guessing)
@@ -922,7 +922,7 @@ public void powExpr() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
powExpr_AST = (Spring.Expressions.SpringAST)currentAST.root;
}
@@ -940,14 +940,14 @@ public void powExpr() //throws RecognitionException, TokenStreamException
}
returnAST = powExpr_AST;
}
-
+
public void unaryExpression() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST unaryExpression_AST = null;
-
+
try { // for error handling
if ((LA(1)==PLUS||LA(1)==MINUS||LA(1)==BANG))
{
@@ -1003,7 +1003,7 @@ public void unaryExpression() //throws RecognitionException, TokenStreamExceptio
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
catch (RecognitionException ex)
{
@@ -1019,14 +1019,14 @@ public void unaryExpression() //throws RecognitionException, TokenStreamExceptio
}
returnAST = unaryExpression_AST;
}
-
+
public void primaryExpression() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST primaryExpression_AST = null;
-
+
try { // for error handling
startNode();
if (0 == inputState.guessing)
@@ -1048,7 +1048,7 @@ public void primaryExpression() //throws RecognitionException, TokenStreamExcept
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
if (0==inputState.guessing)
{
@@ -1077,14 +1077,14 @@ public void primaryExpression() //throws RecognitionException, TokenStreamExcept
}
returnAST = primaryExpression_AST;
}
-
+
public void unaryOperator() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST unaryOperator_AST = null;
-
+
try { // for error handling
switch ( LA(1) )
{
@@ -1135,14 +1135,14 @@ public void unaryOperator() //throws RecognitionException, TokenStreamException
}
returnAST = unaryOperator_AST;
}
-
+
public void startNode() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST startNode_AST = null;
-
+
try { // for error handling
{
switch ( LA(1) )
@@ -1347,14 +1347,14 @@ public void startNode() //throws RecognitionException, TokenStreamException
}
returnAST = startNode_AST;
}
-
+
public void node() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST node_AST = null;
-
+
try { // for error handling
{ // ( ... )+
int _cnt43=0;
@@ -1455,14 +1455,14 @@ public void node() //throws RecognitionException, TokenStreamException
}
returnAST = node_AST;
}
-
+
public void methodOrProperty() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST methodOrProperty_AST = null;
-
+
try { // for error handling
bool synPredMatched56 = false;
if (((LA(1)==ID) && (LA(2)==LPAREN)))
@@ -1508,7 +1508,7 @@ public void methodOrProperty() //throws RecognitionException, TokenStreamExcepti
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
catch (RecognitionException ex)
{
@@ -1524,14 +1524,14 @@ public void methodOrProperty() //throws RecognitionException, TokenStreamExcepti
}
returnAST = methodOrProperty_AST;
}
-
+
public void functionOrVar() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST functionOrVar_AST = null;
-
+
try { // for error handling
bool synPredMatched46 = false;
if (((LA(1)==POUND) && (LA(2)==ID)))
@@ -1574,7 +1574,7 @@ public void functionOrVar() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
catch (RecognitionException ex)
{
@@ -1590,14 +1590,14 @@ public void functionOrVar() //throws RecognitionException, TokenStreamException
}
returnAST = functionOrVar_AST;
}
-
+
public void localFunctionOrVar() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST localFunctionOrVar_AST = null;
-
+
try { // for error handling
bool synPredMatched51 = false;
if (((LA(1)==DOLLAR) && (LA(2)==ID)))
@@ -1640,7 +1640,7 @@ public void localFunctionOrVar() //throws RecognitionException, TokenStreamExcep
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
catch (RecognitionException ex)
{
@@ -1656,17 +1656,17 @@ public void localFunctionOrVar() //throws RecognitionException, TokenStreamExcep
}
returnAST = localFunctionOrVar_AST;
}
-
+
public void reference() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST reference_AST = null;
Spring.Expressions.SpringAST cn_AST = null;
Spring.Expressions.SpringAST id_AST = null;
Spring.Expressions.SpringAST localid_AST = null;
-
+
try { // for error handling
bool synPredMatched64 = false;
if (((LA(1)==AT) && (LA(2)==LPAREN)))
@@ -1744,7 +1744,7 @@ public void reference() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
catch (RecognitionException ex)
{
@@ -1760,14 +1760,14 @@ public void reference() //throws RecognitionException, TokenStreamException
}
returnAST = reference_AST;
}
-
+
public void indexer() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST indexer_AST = null;
-
+
try { // for error handling
Spring.Expressions.IndexerNode tmp46_AST = null;
tmp46_AST = (Spring.Expressions.IndexerNode) astFactory.create(LT(1), "Spring.Expressions.IndexerNode");
@@ -1794,7 +1794,7 @@ public void indexer() //throws RecognitionException, TokenStreamException
{
goto _loop67_breakloop;
}
-
+
}
_loop67_breakloop: ;
} // ( ... )*
@@ -1815,14 +1815,14 @@ public void indexer() //throws RecognitionException, TokenStreamException
}
returnAST = indexer_AST;
}
-
+
public void literal() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST literal_AST = null;
-
+
try { // for error handling
switch ( LA(1) )
{
@@ -1902,15 +1902,15 @@ public void literal() //throws RecognitionException, TokenStreamException
}
returnAST = literal_AST;
}
-
+
public void type() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST type_AST = null;
Spring.Expressions.SpringAST tn_AST = null;
-
+
try { // for error handling
match(TYPE);
name();
@@ -1946,15 +1946,15 @@ public void type() //throws RecognitionException, TokenStreamException
}
returnAST = type_AST;
}
-
+
public void constructor() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST constructor_AST = null;
Spring.Expressions.SpringAST type_AST = null;
-
+
try { // for error handling
bool synPredMatched90 = false;
if (((LA(1)==LITERAL_new) && (LA(2)==ID)))
@@ -2014,7 +2014,7 @@ public void constructor() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
catch (RecognitionException ex)
{
@@ -2030,14 +2030,14 @@ public void constructor() //throws RecognitionException, TokenStreamException
}
returnAST = constructor_AST;
}
-
+
public void projection() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST projection_AST = null;
-
+
try { // for error handling
Spring.Expressions.ProjectionNode tmp57_AST = null;
tmp57_AST = (Spring.Expressions.ProjectionNode) astFactory.create(LT(1), "Spring.Expressions.ProjectionNode");
@@ -2065,14 +2065,14 @@ public void projection() //throws RecognitionException, TokenStreamException
}
returnAST = projection_AST;
}
-
+
public void selection() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST selection_AST = null;
-
+
try { // for error handling
Spring.Expressions.SelectionNode tmp59_AST = null;
tmp59_AST = (Spring.Expressions.SelectionNode) astFactory.create(LT(1), "Spring.Expressions.SelectionNode");
@@ -2099,7 +2099,7 @@ public void selection() //throws RecognitionException, TokenStreamException
{
goto _loop71_breakloop;
}
-
+
}
_loop71_breakloop: ;
} // ( ... )*
@@ -2120,14 +2120,14 @@ public void selection() //throws RecognitionException, TokenStreamException
}
returnAST = selection_AST;
}
-
+
public void firstSelection() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST firstSelection_AST = null;
-
+
try { // for error handling
Spring.Expressions.SelectionFirstNode tmp62_AST = null;
tmp62_AST = (Spring.Expressions.SelectionFirstNode) astFactory.create(LT(1), "Spring.Expressions.SelectionFirstNode");
@@ -2155,14 +2155,14 @@ public void firstSelection() //throws RecognitionException, TokenStreamException
}
returnAST = firstSelection_AST;
}
-
+
public void lastSelection() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST lastSelection_AST = null;
-
+
try { // for error handling
Spring.Expressions.SelectionLastNode tmp64_AST = null;
tmp64_AST = (Spring.Expressions.SelectionLastNode) astFactory.create(LT(1), "Spring.Expressions.SelectionLastNode");
@@ -2190,14 +2190,14 @@ public void lastSelection() //throws RecognitionException, TokenStreamException
}
returnAST = lastSelection_AST;
}
-
+
public void listInitializer() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST listInitializer_AST = null;
-
+
try { // for error handling
Spring.Expressions.ListInitializerNode tmp66_AST = null;
tmp66_AST = (Spring.Expressions.ListInitializerNode) astFactory.create(LT(1), "Spring.Expressions.ListInitializerNode");
@@ -2224,7 +2224,7 @@ public void listInitializer() //throws RecognitionException, TokenStreamExceptio
{
goto _loop99_breakloop;
}
-
+
}
_loop99_breakloop: ;
} // ( ... )*
@@ -2245,14 +2245,14 @@ public void listInitializer() //throws RecognitionException, TokenStreamExceptio
}
returnAST = listInitializer_AST;
}
-
+
public void mapInitializer() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST mapInitializer_AST = null;
-
+
try { // for error handling
match(POUND);
Spring.Expressions.MapInitializerNode tmp70_AST = null;
@@ -2280,7 +2280,7 @@ public void mapInitializer() //throws RecognitionException, TokenStreamException
{
goto _loop102_breakloop;
}
-
+
}
_loop102_breakloop: ;
} // ( ... )*
@@ -2301,14 +2301,14 @@ public void mapInitializer() //throws RecognitionException, TokenStreamException
}
returnAST = mapInitializer_AST;
}
-
+
public void lambda() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST lambda_AST = null;
-
+
try { // for error handling
match(LAMBDA);
{
@@ -2326,7 +2326,7 @@ public void lambda() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
match(PIPE);
expression();
@@ -2362,15 +2362,15 @@ public void lambda() //throws RecognitionException, TokenStreamException
}
returnAST = lambda_AST;
}
-
+
public void attribute() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST attribute_AST = null;
Spring.Expressions.SpringAST tn_AST = null;
-
+
try { // for error handling
match(AT);
match(LBRACKET);
@@ -2394,7 +2394,7 @@ public void attribute() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
match(RBRACKET);
if (0==inputState.guessing)
@@ -2424,14 +2424,14 @@ public void attribute() //throws RecognitionException, TokenStreamException
}
returnAST = attribute_AST;
}
-
+
public void function() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST function_AST = null;
-
+
try { // for error handling
match(POUND);
Spring.Expressions.FunctionNode tmp80_AST = null;
@@ -2459,14 +2459,14 @@ public void function() //throws RecognitionException, TokenStreamException
}
returnAST = function_AST;
}
-
+
public void var() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST var_AST = null;
-
+
try { // for error handling
match(POUND);
Spring.Expressions.VariableNode tmp82_AST = null;
@@ -2489,14 +2489,14 @@ public void var() //throws RecognitionException, TokenStreamException
}
returnAST = var_AST;
}
-
+
public void methodArgs() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST methodArgs_AST = null;
-
+
try { // for error handling
match(LPAREN);
{
@@ -2523,7 +2523,7 @@ public void methodArgs() //throws RecognitionException, TokenStreamException
{
goto _loop60_breakloop;
}
-
+
}
_loop60_breakloop: ;
} // ( ... )*
@@ -2534,7 +2534,7 @@ public void methodArgs() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
match(RPAREN);
methodArgs_AST = (Spring.Expressions.SpringAST)currentAST.root;
@@ -2553,14 +2553,14 @@ public void methodArgs() //throws RecognitionException, TokenStreamException
}
returnAST = methodArgs_AST;
}
-
+
public void localFunction() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST localFunction_AST = null;
-
+
try { // for error handling
match(DOLLAR);
Spring.Expressions.LocalFunctionNode tmp87_AST = null;
@@ -2588,14 +2588,14 @@ public void localFunction() //throws RecognitionException, TokenStreamException
}
returnAST = localFunction_AST;
}
-
+
public void localVar() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST localVar_AST = null;
-
+
try { // for error handling
match(DOLLAR);
Spring.Expressions.LocalVariableNode tmp89_AST = null;
@@ -2618,14 +2618,14 @@ public void localVar() //throws RecognitionException, TokenStreamException
}
returnAST = localVar_AST;
}
-
+
public void property() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST property_AST = null;
-
+
try { // for error handling
Spring.Expressions.PropertyOrFieldNode tmp90_AST = null;
tmp90_AST = (Spring.Expressions.PropertyOrFieldNode) astFactory.create(LT(1), "Spring.Expressions.PropertyOrFieldNode");
@@ -2647,14 +2647,14 @@ public void property() //throws RecognitionException, TokenStreamException
}
returnAST = property_AST;
}
-
+
public void argument() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST argument_AST = null;
-
+
try { // for error handling
expression();
if (0 == inputState.guessing)
@@ -2677,14 +2677,14 @@ public void argument() //throws RecognitionException, TokenStreamException
}
returnAST = argument_AST;
}
-
+
public void quotableName() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST quotableName_AST = null;
-
+
try { // for error handling
if ((LA(1)==STRING_LITERAL))
{
@@ -2706,7 +2706,7 @@ public void quotableName() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
catch (RecognitionException ex)
{
@@ -2722,14 +2722,14 @@ public void quotableName() //throws RecognitionException, TokenStreamException
}
returnAST = quotableName_AST;
}
-
+
public void name() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST name_AST = null;
-
+
try { // for error handling
Spring.Expressions.QualifiedIdentifier tmp92_AST = null;
tmp92_AST = (Spring.Expressions.QualifiedIdentifier) astFactory.create(LT(1), "Spring.Expressions.QualifiedIdentifier");
@@ -2751,7 +2751,7 @@ public void name() //throws RecognitionException, TokenStreamException
{
goto _loop78_breakloop;
}
-
+
}
_loop78_breakloop: ;
} // ( ... )*
@@ -2771,14 +2771,14 @@ public void name() //throws RecognitionException, TokenStreamException
}
returnAST = name_AST;
}
-
+
public void qualifiedId() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST qualifiedId_AST = null;
-
+
try { // for error handling
Spring.Expressions.QualifiedIdentifier tmp94_AST = null;
tmp94_AST = (Spring.Expressions.QualifiedIdentifier) astFactory.create(LT(1), "Spring.Expressions.QualifiedIdentifier");
@@ -2802,7 +2802,7 @@ public void qualifiedId() //throws RecognitionException, TokenStreamException
{
goto _loop114_breakloop;
}
-
+
}
_loop114_breakloop: ;
} // ( ... )*
@@ -2822,14 +2822,14 @@ public void qualifiedId() //throws RecognitionException, TokenStreamException
}
returnAST = qualifiedId_AST;
}
-
+
public void ctorArgs() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST ctorArgs_AST = null;
-
+
try { // for error handling
match(LPAREN);
{
@@ -2856,7 +2856,7 @@ public void ctorArgs() //throws RecognitionException, TokenStreamException
{
goto _loop107_breakloop;
}
-
+
}
_loop107_breakloop: ;
} // ( ... )*
@@ -2867,7 +2867,7 @@ public void ctorArgs() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
match(RPAREN);
ctorArgs_AST = (Spring.Expressions.SpringAST)currentAST.root;
@@ -2886,14 +2886,14 @@ public void ctorArgs() //throws RecognitionException, TokenStreamException
}
returnAST = ctorArgs_AST;
}
-
+
public void argList() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST argList_AST = null;
-
+
try { // for error handling
{
Spring.Expressions.SpringAST tmp100_AST = null;
@@ -2915,7 +2915,7 @@ public void argList() //throws RecognitionException, TokenStreamException
{
goto _loop87_breakloop;
}
-
+
}
_loop87_breakloop: ;
} // ( ... )*
@@ -2947,15 +2947,15 @@ public void argList() //throws RecognitionException, TokenStreamException
}
returnAST = argList_AST;
}
-
+
public void arrayConstructor() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST arrayConstructor_AST = null;
Spring.Expressions.SpringAST type_AST = null;
-
+
try { // for error handling
match(LITERAL_new);
qualifiedId();
@@ -2983,7 +2983,7 @@ public void arrayConstructor() //throws RecognitionException, TokenStreamExcepti
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
if (0==inputState.guessing)
{
@@ -3012,14 +3012,14 @@ public void arrayConstructor() //throws RecognitionException, TokenStreamExcepti
}
returnAST = arrayConstructor_AST;
}
-
+
public void arrayRank() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST arrayRank_AST = null;
-
+
try { // for error handling
Spring.Expressions.SpringAST tmp104_AST = null;
tmp104_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1));
@@ -3049,7 +3049,7 @@ public void arrayRank() //throws RecognitionException, TokenStreamException
{
goto _loop96_breakloop;
}
-
+
}
_loop96_breakloop: ;
} // ( ... )*
@@ -3060,7 +3060,7 @@ public void arrayRank() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
match(RBRACKET);
arrayRank_AST = (Spring.Expressions.SpringAST)currentAST.root;
@@ -3079,14 +3079,14 @@ public void arrayRank() //throws RecognitionException, TokenStreamException
}
returnAST = arrayRank_AST;
}
-
+
public void mapEntry() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST mapEntry_AST = null;
-
+
try { // for error handling
expression();
if (0 == inputState.guessing)
@@ -3126,14 +3126,14 @@ public void mapEntry() //throws RecognitionException, TokenStreamException
}
returnAST = mapEntry_AST;
}
-
+
public void namedArgument() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST namedArgument_AST = null;
-
+
try { // for error handling
bool synPredMatched111 = false;
if (((LA(1)==ID) && (LA(2)==ASSIGN)))
@@ -3180,7 +3180,7 @@ public void namedArgument() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
catch (RecognitionException ex)
{
@@ -3196,14 +3196,14 @@ public void namedArgument() //throws RecognitionException, TokenStreamException
}
returnAST = namedArgument_AST;
}
-
+
public void boolLiteral() //throws RecognitionException, TokenStreamException
{
-
+
returnAST = null;
ASTPair currentAST = new ASTPair();
Spring.Expressions.SpringAST boolLiteral_AST = null;
-
+
try { // for error handling
if ((LA(1)==TRUE))
{
@@ -3224,7 +3224,7 @@ public void boolLiteral() //throws RecognitionException, TokenStreamException
{
throw new NoViableAltException(LT(1), getFilename());
}
-
+
}
catch (RecognitionException ex)
{
@@ -3240,12 +3240,12 @@ public void boolLiteral() //throws RecognitionException, TokenStreamException
}
returnAST = boolLiteral_AST;
}
-
+
public new Spring.Expressions.SpringAST getAST()
{
return (Spring.Expressions.SpringAST) returnAST;
}
-
+
private void initializeFactory()
{
if (astFactory == null)
@@ -3258,7 +3258,7 @@ static public void initializeASTFactory( ASTFactory factory )
{
factory.setMaxNodeType(71);
}
-
+
public static readonly string[] tokenNames_ = new string[] {
@"""<0>""",
@"""EOF""",
@@ -3333,7 +3333,7 @@ static public void initializeASTFactory( ASTFactory factory )
@"""SIGN""",
@"""REAL_TYPE_SUFFIX"""
};
-
+
private static long[] mk_tokenSet_0_()
{
long[] data = { 2L, 0L};
@@ -3478,6 +3478,6 @@ private static long[] mk_tokenSet_23_()
return data;
}
public static readonly BitSet tokenSet_23_ = new BitSet(mk_tokenSet_23_());
-
+
}
}
diff --git a/src/Spring/Spring.Core/Objects/Factory/Config/ConfigurationReader.cs b/src/Spring/Spring.Core/Objects/Factory/Config/ConfigurationReader.cs
index 1dadff8f7..1bc2de2df 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Config/ConfigurationReader.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Config/ConfigurationReader.cs
@@ -1,14 +1,14 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
- *
+ * Copyright © 2002-2011 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,11 +41,11 @@
namespace Spring.Objects.Factory.Config
{
///
- /// Various utility methods for .NET style .config files.
+ /// Various utility methods for .NET style .config files.
///
///
///
- /// Currently supports reading custom configuration sections and returning them as
+ /// Currently supports reading custom configuration sections and returning them as
/// objects.
///
///
@@ -314,7 +314,7 @@ public static object GetSectionFromXmlDocument(XmlDocument document, string conf
if (typeof(IConfigurationSectionHandler).IsAssignableFrom(handlerType))
{
IConfigurationSectionHandler handler = (IConfigurationSectionHandler)ObjectUtils.InstantiateType(handlerType);
- return ((IConfigurationSectionHandler)handler).Create(null, null, sectionContent);
+ return handler.Create(null, null, sectionContent);
}
// NET 2.0 ConfigurationSection
@@ -362,7 +362,7 @@ private static Type GetSectionHandlerType(XmlDocument document, string configSec
handlerType = defaultConfigurationSectionHandlerType;
}
}
-
+
if (xmlConfig != null)
{
XmlAttribute xmlConfigType = xmlConfig.Attributes[ConfigSectionTypeAttribute];
diff --git a/src/Spring/Spring.Core/Objects/Factory/Config/SharedStateAwareProcessor.cs b/src/Spring/Spring.Core/Objects/Factory/Config/SharedStateAwareProcessor.cs
index 94f4971d4..56484badd 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Config/SharedStateAwareProcessor.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Config/SharedStateAwareProcessor.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectDefinitionParserHelper.cs b/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectDefinitionParserHelper.cs
index 1f600838c..1b2b3be69 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectDefinitionParserHelper.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectDefinitionParserHelper.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ namespace Spring.Objects.Factory.Xml
///
/// Stateful class used to parse XML object definitions.
///
- /// Not all parsing code has been refactored into this class. See
+ /// Not all parsing code has been refactored into this class. See
/// BeanDefinitionParserDelegate in Java for how this class should evolve.
/// Rob Harrop
/// Juergen Hoeller
@@ -84,7 +84,7 @@ public ObjectDefinitionParserHelper(XmlReaderContext readerContext, XmlElement r
}
///
- /// Gets the defaults definition object, or null if the
+ /// Gets the defaults definition object, or null if the
/// default have not yet been initialized.
///
/// The defaults.
@@ -341,7 +341,7 @@ public ObjectDefinitionHolder ParseObjectDefinitionElement(XmlElement element, I
{
if (aliases.Count > 0)
{
- objectName = (string) aliases[0];
+ objectName = aliases[0];
aliases.RemoveAt(0);
if (log.IsDebugEnabled)
{
@@ -373,9 +373,9 @@ public ObjectDefinitionHolder ParseObjectDefinitionElement(XmlElement element, I
objectName = readerContext.GenerateObjectName(definition);
// Register an alias for the plain object type name, if possible.
string objectTypeName = definition.ObjectTypeName;
- if (objectTypeName != null
- && objectName.StartsWith(objectTypeName)
- && objectName.Length>objectTypeName.Length
+ if (objectTypeName != null
+ && objectName.StartsWith(objectTypeName)
+ && objectName.Length>objectTypeName.Length
&& !readerContext.Registry.IsObjectNameInUse(objectTypeName))
{
aliases.Add(objectTypeName);
@@ -543,7 +543,7 @@ public ObjectDefinitionBuilder CreateRootObjectDefinitionBuilder(Type objectType
/// Returns the value of the element's attribute or null , if the attribute is not specified.
///
///
- /// This is a helper for bypassing the behavior of
+ /// This is a helper for bypassing the behavior of
/// to return if the attribute does not exist.
///
public string GetAttributeValue(XmlElement element, string attributeName)
@@ -556,11 +556,11 @@ public string GetAttributeValue(XmlElement element, string attributeName)
}
///
- /// Returns the value of the element's attribute or ,
+ /// Returns the value of the element's attribute or ,
/// if the attribute is not specified.
///
///
- /// This is a helper for bypassing the behavior of
+ /// This is a helper for bypassing the behavior of
/// to return if the attribute does not exist.
///
public string GetAttributeValue(XmlElement element, string attributeName, string defaultValue)
diff --git a/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectsNamespaceParser.cs b/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectsNamespaceParser.cs
index 6495938fa..6aec4f8a7 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectsNamespaceParser.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectsNamespaceParser.cs
@@ -276,8 +276,8 @@ protected virtual void ParseEventListenerDefinition(
case ObjectDefinitionConstants.TypeAttribute:
// we're wiring up to a static event exposed on a Type (class)
myHandler.Source = parserContext.ReaderContext.Reader.Domain == null ?
- (object)sourceAtt.Value :
- (object)TypeResolutionUtils.ResolveType(sourceAtt.Value);
+ sourceAtt.Value :
+ TypeResolutionUtils.ResolveType(sourceAtt.Value) as object;
break;
}
events.AddHandler(myHandler);
@@ -481,7 +481,7 @@ AbstractObjectDefinition od
autowire = childParserContext.ParserHelper.Defaults.Autowire;
}
od.AutowireMode = GetAutowireMode(autowire);
-
+
string autowireCandidates = GetAttributeValue(element, ObjectDefinitionConstants.AutowireCandidateAttribute);
if (string.IsNullOrEmpty(autowireCandidates) || ObjectDefinitionConstants.DefaultValue.Equals(autowireCandidates))
{
@@ -695,7 +695,7 @@ protected void ParseMetaElements(XmlElement element, ObjectMetadataAttributeAcce
ObjectMetadataAttribute attribute = new ObjectMetadataAttribute(key, value);
attribute.Source = (XmlElement)node;
- attributeAccessor.AddMetadataAttribute(attribute);
+ attributeAccessor.AddMetadataAttribute(attribute);
}
}
@@ -724,7 +724,7 @@ public void ParseQualifierElement(string name, XmlElement element, ParserContext
parserContext.ReaderContext.Resource, name,
"Tag 'qualifier' must have a 'type' attribute");
}
-
+
var qualifier = new AutowireCandidateQualifier(typeName);
qualifier.Source = element;
@@ -1180,7 +1180,7 @@ private bool ParseMergeAttribute(XmlElement collectionElement, ObjectDefinitionP
///
/// The set definition.
protected Set ParseSetElement(XmlElement collectionEle, string name, ParserContext parserContext)
- {
+ {
string elementTypeName = GetAttributeValue(collectionEle, "element-type");
XmlNodeList nl = collectionEle.ChildNodes;
ManagedSet target = new ManagedSet(nl.Count);
@@ -1556,7 +1556,7 @@ private string GetNamespacePrefix(XmlElement element)
// /// Returns the value of the element's attribute or null , if the attribute is not specified.
// ///
// ///
-// /// This is a helper for bypassing the behavior of
+// /// This is a helper for bypassing the behavior of
// /// to return if the attribute does not exist.
// ///
// protected static string GetAttributeValue(XmlElement element, string attributeName)
@@ -1569,11 +1569,11 @@ private string GetNamespacePrefix(XmlElement element)
// }
//
// ///
-// /// Returns the value of the element's attribute or ,
+// /// Returns the value of the element's attribute or ,
// /// if the attribute is not specified.
// ///
// ///
-// /// This is a helper for bypassing the behavior of
+// /// This is a helper for bypassing the behavior of
// /// to return if the attribute does not exist.
// ///
// protected static string GetAttributeValue(XmlElement element, string attributeName, string defaultValue)
diff --git a/src/Spring/Spring.Core/Objects/Support/AutoWiringEventHandlerValue.cs b/src/Spring/Spring.Core/Objects/Support/AutoWiringEventHandlerValue.cs
index 8179e9e1b..9a1a58745 100644
--- a/src/Spring/Spring.Core/Objects/Support/AutoWiringEventHandlerValue.cs
+++ b/src/Spring/Spring.Core/Objects/Support/AutoWiringEventHandlerValue.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -222,7 +222,7 @@ private void WireEvent(EventInfo theEvent)
#endregion
IEventHandlerValue myHandler = method.IsStatic ?
- (IEventHandlerValue) new StaticEventHandlerValue() :
+ new StaticEventHandlerValue() :
(IEventHandlerValue) new InstanceEventHandlerValue();
myHandler.EventName = theEvent.Name;
myHandler.MethodName = method.Name;
diff --git a/src/Spring/Spring.Core/Objects/Support/MethodInvoker.cs b/src/Spring/Spring.Core/Objects/Support/MethodInvoker.cs
index 3d9350058..04305cef7 100644
--- a/src/Spring/Spring.Core/Objects/Support/MethodInvoker.cs
+++ b/src/Spring/Spring.Core/Objects/Support/MethodInvoker.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ namespace Spring.Objects.Support
/// .
///
///
- /// Usage: specify either the and
+ /// Usage: specify either the and
/// or the
/// and
/// properties respectively, and
@@ -58,13 +58,13 @@ namespace Spring.Objects.Support
/// arguments.
///
///
- /// public class Foo
+ /// public class Foo
/// {
/// public string ToString(string name, int age, string address)
/// {
/// return string.Format("{0}, {1} years old, {2}", name, age, address);
/// }
- ///
+ ///
/// public static void Main()
/// {
/// Foo foo = new Foo();
@@ -352,7 +352,7 @@ private void PrepareArguments()
}
// look up the index of where in the prepared args array we're gonna stick the named argument value
- int namedArgumentsIndex = (int) argumentNamesToIndexes[argumentName];
+ int namedArgumentsIndex = argumentNamesToIndexes[argumentName];
PreparedArguments[namedArgumentsIndex] = argumentValue;
// we've prepped this index position, so mark it as so...
argumentNamesToIndexes[argumentName] = THE_ARGUMENT_IS_PREPARED;
@@ -420,7 +420,7 @@ protected virtual MethodInfo FindTheMethodToInvoke()
}
if (theMethod == null)
{
- // search for a method with a matching signature...
+ // search for a method with a matching signature...
ComposedCriteria searchCriteria = new ComposedCriteria();
searchCriteria.Add(new MethodNameMatchCriteria(genericInfo.GenericMethodName));
searchCriteria.Add(new MethodParametersCountCriteria(ArgumentCount));
diff --git a/src/Spring/Spring.Core/Util/NumberUtils.cs b/src/Spring/Spring.Core/Util/NumberUtils.cs
index 1e92570a5..db1f5bdd6 100644
--- a/src/Spring/Spring.Core/Util/NumberUtils.cs
+++ b/src/Spring/Spring.Core/Util/NumberUtils.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/Generic/HibernateTemplate.cs b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/Generic/HibernateTemplate.cs
index 1ebfbc21a..c4ee3617c 100644
--- a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/Generic/HibernateTemplate.cs
+++ b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/Generic/HibernateTemplate.cs
@@ -1,14 +1,14 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
- *
+ * Copyright � 2002-2011 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,18 +50,18 @@ namespace Spring.Data.NHibernate.Generic
/// or handling Session lifecycle exceptions. For typical single step actions,
/// there are various convenience methods (Find, Load, SaveOrUpdate, Delete).
///
- ///
+ ///
/// Can be used within a service implementation via direct instantiation
/// with a ISessionFactory reference, or get prepared in an application context
/// and given to services as an object reference. Note: The ISessionFactory should
/// always be configured as an object in the application context, in the first case
/// given to the service directly, in the second case to the prepared template.
///
- ///
+ ///
/// This class can be considered as a direct alternative to working with the raw
/// Hibernate Session API (through SessionFactoryUtils.Session).
///
- ///
+ ///
/// LocalSessionFactoryObject is the preferred way of obtaining a reference
/// to a specific NHibernate ISessionFactory.
///
@@ -73,8 +73,8 @@ public class HibernateTemplate : HibernateAccessor, IHibernateOperations
#region Fields
NHibernate.HibernateTemplate classicHibernateTemplate;
-
- #endregion
+
+ #endregion
#region Constructor (s)
@@ -89,25 +89,25 @@ public HibernateTemplate()
///
/// Initializes a new instance of the class.
///
- /// Allows creation of a new non-transactional session when no
+ /// Allows creation of a new non-transactional session when no
/// transactional Session can be found for the current thread
/// The session factory to create sessions.
public HibernateTemplate(ISessionFactory sessionFactory)
{
- classicHibernateTemplate = new Spring.Data.NHibernate.HibernateTemplate(sessionFactory);
+ classicHibernateTemplate = new Spring.Data.NHibernate.HibernateTemplate(sessionFactory);
AfterPropertiesSet();
}
///
/// Initializes a new instance of the class.
///
- /// The session factory to create sessions.
+ /// The session factory to create sessions.
/// if set to true allow creation
- /// of a new non-transactional session when no transactional Session can be found
+ /// of a new non-transactional session when no transactional Session can be found
/// for the current thread.
public HibernateTemplate(ISessionFactory sessionFactory, bool allowCreate)
{
- classicHibernateTemplate = new Spring.Data.NHibernate.HibernateTemplate(sessionFactory, allowCreate);
+ classicHibernateTemplate = new Spring.Data.NHibernate.HibernateTemplate(sessionFactory, allowCreate);
AfterPropertiesSet();
}
@@ -247,7 +247,7 @@ public override IObjectFactory ObjectFactory
}
///
- /// Gets or sets a value indicating whether to
+ /// Gets or sets a value indicating whether to
/// cache all queries executed by this template.
///
///
@@ -344,7 +344,7 @@ public NHibernate.HibernateTemplate ClassicHibernateTemplate
///
/// Gets or sets the proxy factory.
///
- /// This may be useful to set if you create many instances of
+ /// This may be useful to set if you create many instances of
/// HibernateTemplate and/or HibernateDaoSupport. This allows the same
/// ProxyFactory implementation to be used thereby limiting the
/// number of dynamic proxy types created in the temporary assembly, which
@@ -362,8 +362,8 @@ public virtual ProxyFactory ProxyFactory
#region Properties
-
-
+
+
#endregion
#region Methods
@@ -374,7 +374,7 @@ public virtual ProxyFactory ProxyFactory
///
public void Clear()
{
- classicHibernateTemplate.Clear();
+ classicHibernateTemplate.Clear();
}
@@ -606,13 +606,13 @@ public object SaveOrUpdateCopy(object entity)
#endif
///
- /// Copy the state of the given object onto the persistent object with the same identifier.
+ /// Copy the state of the given object onto the persistent object with the same identifier.
/// If there is no persistent instance currently associated with the session, it will be loaded.
- /// Return the persistent instance. If the given instance is unsaved,
+ /// Return the persistent instance. If the given instance is unsaved,
/// save a copy of and return it as a newly persistent instance.
- /// The given instance does not become associated with the session.
+ /// The given instance does not become associated with the session.
/// This operation cascades to associated instances if the association is mapped with cascade="merge".
- /// The semantics of this method are defined by JSR-220.
+ /// The semantics of this method are defined by JSR-220.
///
/// The persistent object to merge.
/// (not necessarily to be associated with the Hibernate Session)
@@ -636,7 +636,7 @@ public object Merge(object entity)
/// The object type to get.
/// The id of the object to get.
/// the persistent instance, or null if not found
- /// In case of Hibernate errors
+ /// In case of Hibernate errors
public T Get(object id)
{
return Get(id, null);
@@ -668,7 +668,7 @@ public T Get(object id, LockMode lockMode)
/// The object type to load.
/// An identifier of the persistent instance.
/// The persistent instance
- /// If not found
+ /// If not found
/// In case of Hibernate errors
public T Load(object id)
{
@@ -684,8 +684,8 @@ public T Load(object id)
/// An identifier of the persistent instance.
/// The lock mode.
/// The persistent instance
- /// If not found
- /// In case of Hibernate errors
+ /// If not found
+ /// In case of Hibernate errors
public T Load(object id, LockMode lockMode)
{
return Execute(new LoadByTypeHibernateCallback(id, lockMode), true);
@@ -715,7 +715,7 @@ public IList LoadAll()
///
/// a generic List containing 0 or more persistent instances
///
- /// In case of Hibernate errors
+ /// In case of Hibernate errors
public IList Find(string queryString)
{
return Find(queryString, (object[]) null, (IType[]) null);
@@ -731,7 +731,7 @@ public IList Find(string queryString)
///
/// a generic List containing 0 or more persistent instances
///
- /// In case of Hibernate errors
+ /// In case of Hibernate errors
public IList Find(string queryString, object value)
{
return Find(queryString, new object[] {value}, (IType[]) null);
@@ -748,7 +748,7 @@ public IList Find(string queryString, object value)
///
/// a generic List containing 0 or more persistent instances
///
- /// In case of Hibernate errors
+ /// In case of Hibernate errors
public IList Find(string queryString, object value, IType type)
{
return Find(queryString, new object[] {value}, new IType[] {type});
@@ -762,7 +762,7 @@ public IList Find(string queryString, object value, IType type)
/// a query expressed in Hibernate's query language
/// the values of the parameters
/// a generic List containing 0 or more persistent instances
- /// In case of Hibernate errors
+ /// In case of Hibernate errors
public IList Find(string queryString, object[] values)
{
return Find(queryString, values, (IType[]) null);
@@ -779,8 +779,8 @@ public IList Find(string queryString, object[] values)
///
/// a generic List containing 0 or more persistent instances
///
- /// In case of Hibernate errors
- /// If values and types are not null and their lengths are not equal
+ /// In case of Hibernate errors
+ /// If values and types are not null and their lengths are not equal
public IList Find(string queryString, object[] values, IType[] types)
{
if (values != null && types != null && values.Length != types.Length)
@@ -1009,7 +1009,7 @@ public IList FindByNamedQueryAndNamedParam(string queryName, string[] para
/// A generic List containing 0 or more persistent instances
/// In case of Hibernate errors
/// If paramNames length is not equal to values length or
- /// if paramNames length is not equal to types length (when types is not null)
+ /// if paramNames length is not equal to types length (when types is not null)
public IList FindByNamedQueryAndNamedParam(string queryName, string[] paramNames, object[] values,
IType[] types)
{
@@ -1050,7 +1050,7 @@ public IList FindByNamedQueryAndValueObject(string queryName, object value
/// of the given object to named parameters in the query string.
///
/// The object type to find.
- /// A query expressed in Hibernate's query language
+ /// A query expressed in Hibernate's query language
/// The values of the parameters
/// A generic List containing 0 or more persistent instances
/// In case of Hibernate errors
diff --git a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTemplate.cs b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTemplate.cs
index df8f2a357..51c7bdc54 100644
--- a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTemplate.cs
+++ b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTemplate.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/LocalSessionFactoryObject.cs b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/LocalSessionFactoryObject.cs
index 7bff9bd90..871c71ab1 100644
--- a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/LocalSessionFactoryObject.cs
+++ b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/LocalSessionFactoryObject.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@ namespace Spring.Data.NHibernate
/// as autodetected by Spring's
/// for AOP-based translation of PersistenceExceptionTranslationPostProcessor.
/// Hence, the presence of e.g. LocalSessionFactoryBean automatically enables
- /// a PersistenceExceptionTranslationPostProcessor to translate Hibernate exceptions.
+ /// a PersistenceExceptionTranslationPostProcessor to translate Hibernate exceptions.
///
///
/// Mark Pollack (.NET)
@@ -117,7 +117,7 @@ public class LocalSessionFactoryObject : IFactoryObject, IInitializingObject, IP
private IApplicationContext applicationContext;
- // Configuration time DB provider.
+ // Configuration time DB provider.
// This will not be available after configuration has been done.
private static IDbProvider configTimeDbProvider;
@@ -508,7 +508,7 @@ public virtual void AfterPropertiesSet()
IDictionary typedProperties = new Dictionary();
foreach (KeyValuePair entry in hibernateProperties)
{
- typedProperties.Add((string) entry.Key, (string) entry.Value);
+ typedProperties.Add(entry.Key, entry.Value);
}
Dialect dialect = Dialect.GetDialect(typedProperties);
@@ -545,7 +545,7 @@ public virtual void AfterPropertiesSet()
log.Info("Overriding use of Spring's Hibernate Connection Provider with [" +
hibernateProperties[Environment.ConnectionProvider] + "]");
}
- #endregion
+ #endregion
config.Properties.Remove(Environment.ConnectionProvider);
}
@@ -625,7 +625,7 @@ public virtual void AfterPropertiesSet()
}
}
- if (this.eventListeners != null)
+ if (this.eventListeners != null)
{
// Register specified NHibernate event listeners.
foreach (DictionaryEntry entry in eventListeners)
@@ -641,7 +641,7 @@ public virtual void AfterPropertiesSet()
}
object listenerObject = entry.Value;
- if (listenerObject is ICollection)
+ if (listenerObject is ICollection)
{
ICollection listeners = (ICollection) listenerObject;
EventListeners listenerRegistry = config.EventListeners;
@@ -651,7 +651,7 @@ public virtual void AfterPropertiesSet()
object[] listenerArray = (object[])items.ToArray(listenerRegistry.GetListenerClassFor(listenerType));
config.SetListeners(listenerType, listenerArray);
}
- else
+ else
{
config.SetListener(listenerType, listenerObject);
}
@@ -694,8 +694,8 @@ public void Dispose()
if (log.IsInfoEnabled)
{
log.Info("Closing Hibernate SessionFactory");
- }
- #endregion
+ }
+ #endregion
sessionFactory.Close();
}
@@ -753,7 +753,7 @@ protected virtual void AfterSessionFactoryCreation()
UpdateDatabaseSchema();
}
}
-
+
///
/// Execute schema drop script, determined by the Configuration object
/// used for creating the SessionFactory. A replacement for NHibernate's
@@ -781,7 +781,7 @@ public void DropDatabaseSchema()
ExecuteSchemaScript(con, sql);
return null;
}));
-
+
}
///
@@ -810,8 +810,8 @@ public void CreateDatabaseSchema()
string[] sql = Configuration.GenerateSchemaCreationScript(dialect);
ExecuteSchemaScript(con, sql);
return null;
-
- }));
+
+ }));
}
///
@@ -829,7 +829,7 @@ public void CreateDatabaseSchema()
/// connection to perform the script.
///
///
- public virtual void UpdateDatabaseSchema()
+ public virtual void UpdateDatabaseSchema()
{
log.Info("Updating database schema for Hibernate SessionFactory");
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
@@ -859,17 +859,17 @@ public virtual void UpdateDatabaseSchema()
/// The SQL statement to execute.
protected virtual void ExecuteSchemaScript(IDbConnection con, string[] sql)
{
- if (sql != null && sql.Length > 0)
+ if (sql != null && sql.Length > 0)
{
IDbCommand cmd = con.CreateCommand();
- try
+ try
{
- for (int i = 0; i < sql.Length; i++)
+ for (int i = 0; i < sql.Length; i++)
{
ExecuteSchemaStatement(cmd, sql[i]);
}
}
- finally
+ finally
{
AdoUtils.DisposeCommand(cmd);
}
@@ -887,18 +887,18 @@ protected virtual void ExecuteSchemaScript(IDbConnection con, string[] sql)
///
protected virtual void ExecuteSchemaStatement(IDbCommand cmd, string sql)
{
- if (log.IsDebugEnabled)
+ if (log.IsDebugEnabled)
{
log.Debug("Executing schema statement: " + sql);
}
- try
+ try
{
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
}
- catch (ADOException ex)
+ catch (ADOException ex)
{
- if (log.IsWarnEnabled)
+ if (log.IsWarnEnabled)
{
log.Warn("Unsuccessful schema statement: " + sql, ex);
}
@@ -921,7 +921,7 @@ protected virtual ISessionFactory NewSessionFactory(Configuration config)
{
ISessionFactory sf = config.BuildSessionFactory();
ISessionFactoryImplementor sfImplementor = sf as ISessionFactoryImplementor;
-
+
if (sfImplementor != null)
{
DbProviderWrapper dbProviderWrapper = sfImplementor.ConnectionProvider as DbProviderWrapper;
@@ -997,7 +997,7 @@ public override IDbConnection GetConnection()
///
///
public DataAccessException TranslateExceptionIfPossible(Exception ex)
- {
+ {
if (ex is HibernateException)
{
return ConvertHibernateException((HibernateException) ex);
@@ -1032,7 +1032,7 @@ protected virtual DataAccessException ConvertHibernateException(HibernateExcepti
///
protected virtual DataAccessException ConvertAdoAccessException(ADOException ex)
{
- return SessionFactoryUtils.ConvertAdoAccessException(AdoExceptionTranslator, ex);
+ return SessionFactoryUtils.ConvertAdoAccessException(AdoExceptionTranslator, ex);
}
#endregion
diff --git a/src/Spring/Spring.Web/Web/UI/Controls/ContentReplacer.cs b/src/Spring/Spring.Web/Web/UI/Controls/ContentReplacer.cs
index b6aa6ca2a..c170b7b1c 100644
--- a/src/Spring/Spring.Web/Web/UI/Controls/ContentReplacer.cs
+++ b/src/Spring/Spring.Web/Web/UI/Controls/ContentReplacer.cs
@@ -36,11 +36,11 @@ namespace Spring.Web.UI.Controls
/// within the page.
///
///
- /// In contrast to control, ContentReplacer can replace the content of
+ /// In contrast to control, ContentReplacer can replace the content of
/// any control within the current page - it is not limited to replacing ContentPlaceholders on master pages.
///
///
- /// This technique is useful if you want to group e.g. rendering navigation elements on 1 ascx control, but your
+ /// This technique is useful if you want to group e.g. rendering navigation elements on 1 ascx control, but your
/// design requires navigation elements to be distributed across different places within the HTML code.
///
///
@@ -71,7 +71,7 @@ protected override void OnPreRender(EventArgs e)
if (!Visible) return;
//log.Debug(string.Format("OnPreRender Content['{0}']", this.contentPlaceHolderID));
- Control ctlRoot = (this.Page.Master != null) ? (Control)this.Page.Master : (Control)this.Page;
+ Control ctlRoot = Page.Master != null ? Page.Master : (Control) Page;
Control ctl = ctlRoot.FindControl(this.contentPlaceHolderID);
if (ctl != null)
@@ -120,7 +120,7 @@ private void RenderNothing(HtmlTextWriter output, Control container)
private static readonly PropertyInfo piRareFieldsEnsured =
typeof(Control).GetProperty("RareFieldsEnsured", BindingFlags.NonPublic | BindingFlags.Instance);
- private static readonly FieldInfo fiRenderMethod =
+ private static readonly FieldInfo fiRenderMethod =
typeof(Control).GetNestedType("ControlRareFields",BindingFlags.NonPublic).GetField("RenderMethod");
private RenderMethod GetRenderMethod()
diff --git a/test/Directory.Build.props b/test/Directory.Build.props
index 110b81d44..88ada2da0 100644
--- a/test/Directory.Build.props
+++ b/test/Directory.Build.props
@@ -22,7 +22,7 @@
3.10.1
3.10.0
- 3.6.1
+ 4.8.1
15.7.2
True
@@ -36,6 +36,7 @@
+ Full
DEBUG;TRACE;$(DefineConstants)
diff --git a/test/Spring/Spring.Aop.Tests/Aop/Framework/AbstractMethodInvocationTests.cs b/test/Spring/Spring.Aop.Tests/Aop/Framework/AbstractMethodInvocationTests.cs
index 36610422d..1f6af64c6 100644
--- a/test/Spring/Spring.Aop.Tests/Aop/Framework/AbstractMethodInvocationTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aop/Framework/AbstractMethodInvocationTests.cs
@@ -18,18 +18,16 @@
#endregion
-#region Imports
-
using System;
using System.Collections;
using System.Globalization;
using System.Reflection;
using AopAlliance.Intercept;
-using NUnit.Framework;
-using Rhino.Mocks;
-#endregion
+using FakeItEasy;
+
+using NUnit.Framework;
namespace Spring.Aop.Framework
{
@@ -41,16 +39,13 @@ namespace Spring.Aop.Framework
[TestFixture]
public abstract class AbstractMethodInvocationTests
{
- private MockRepository mocks;
-
[SetUp]
public virtual void SetUp()
{
- mocks = new MockRepository();
}
protected abstract AbstractMethodInvocation CreateMethodInvocation(
- object proxy, object target, MethodInfo method, MethodInfo onProxyMethod,
+ object proxy, object target, MethodInfo method, MethodInfo onProxyMethod,
object[] arguments, Type targetType, IList interceptors);
[Test]
@@ -178,7 +173,7 @@ public void ValidInvocation()
IMethodInterceptor interceptor = (IMethodInterceptor) repository.CreateMock(typeof (IMethodInterceptor));
AbstractMethodInvocation join = CreateMethodInvocation(
null, target, target.GetTargetMethodNoArgs(), null, null, target.GetType(), new object[] { interceptor });
- Expect.Call(interceptor.Invoke(join)).Return(target.BullseyeMethod().ToLower(CultureInfo.InvariantCulture));
+ Expect.Call(interceptor.Invoke(join)).Returns(target.BullseyeMethod().ToLower(CultureInfo.InvariantCulture));
repository.ReplayAll();
string score = (string) join.Proceed();
Assert.AreEqual(target.BullseyeMethod().ToLower(CultureInfo.InvariantCulture) + Target.Suffix, score);
@@ -186,18 +181,14 @@ public void ValidInvocation()
*/
Target target = new Target();
- IMethodInterceptor mock = (IMethodInterceptor) mocks.CreateMock(typeof(IMethodInterceptor));
+ IMethodInterceptor mock = A.Fake();
AbstractMethodInvocation join = CreateMethodInvocation(
null, target, target.GetTargetMethodNoArgs(), null, null, target.GetType(), new object[] { mock });
-
- Expect.Call(mock.Invoke(null)).IgnoreArguments().Return(target.BullseyeMethod().ToLower(CultureInfo.InvariantCulture));
- mocks.ReplayAll();
+
+ A.CallTo(() => mock.Invoke(null)).WithAnyArguments().Returns(target.BullseyeMethod().ToLower(CultureInfo.InvariantCulture));
string score = (string) join.Proceed();
Assert.AreEqual(Target.DefaultScore.ToLower(CultureInfo.InvariantCulture) + Target.Suffix, score);
-
- mocks.VerifyAll();
-
}
[Test]
@@ -222,53 +213,30 @@ public void UnwrapsTargetInvocationException_NoInterceptors()
[Test]
public void UnwrapsTargetInvocationException_WithInterceptor()
- {
- BadCommand target = new BadCommand();
- IMethodInterceptor mock = (IMethodInterceptor) mocks.CreateMock(typeof(IMethodInterceptor));
- AbstractMethodInvocation join = CreateMethodInvocation(
- null, target, target.GetTargetMethod(), null, null, target.GetType(), new object[] { mock });
-
- Expect.Call(mock.Invoke(null)).IgnoreArguments().Return(null);
- mocks.ReplayAll();
+ {
+ BadCommand target = new BadCommand();
+ IMethodInterceptor mock = A.Fake();
+ AbstractMethodInvocation join = CreateMethodInvocation(
+ null, target, target.GetTargetMethod(), null, null, target.GetType(), new object[] {mock});
- try
- {
- join.Proceed();
- }
- catch (NotImplementedException)
- {
- // this is good, we want this exception to bubble up...
- }
- catch (TargetInvocationException)
- {
- Assert.Fail("Must have unwrapped this.");
- }
- mocks.VerifyAll();
- }
+ A.CallTo(() => mock.Invoke(null)).WithAnyArguments().Throws();
- [Test]
+ // we want this exception to bubble up...
+ Assert.Throws(() => join.Proceed());
+ }
+
+ [Test]
public void UnwrapsTargetInvocationException_WithInterceptorThatThrowsAnException()
{
BadCommand target = new BadCommand();
- IMethodInterceptor mock = (IMethodInterceptor) mocks.CreateMock(typeof(IMethodInterceptor));
+ IMethodInterceptor mock = A.Fake();
AbstractMethodInvocation join = CreateMethodInvocation(
null, target, target.GetTargetMethod(), null, null, target.GetType(), new object[] { mock });
- Expect.Call(mock.Invoke(null)).IgnoreArguments().Throw(new NotImplementedException());
- mocks.ReplayAll();
- try
- {
- join.Proceed();
- }
- catch (NotImplementedException)
- {
- // this is good, we want this exception to bubble up...
- }
- catch (TargetInvocationException)
- {
- Assert.Fail("Must have unwrapped this.");
- }
- mocks.VerifyAll();
+ A.CallTo(() => mock.Invoke(null)).WithAnyArguments().Throws();
+
+ // we want this exception to bubble up...
+ Assert.Throws(() => join.Proceed());
}
}
}
\ No newline at end of file
diff --git a/test/Spring/Spring.Aop.Tests/Aop/Framework/Adapter/AfterReturningAdviceInterceptorTests.cs b/test/Spring/Spring.Aop.Tests/Aop/Framework/Adapter/AfterReturningAdviceInterceptorTests.cs
index 880fb01a5..ca3cb116e 100644
--- a/test/Spring/Spring.Aop.Tests/Aop/Framework/Adapter/AfterReturningAdviceInterceptorTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aop/Framework/Adapter/AfterReturningAdviceInterceptorTests.cs
@@ -18,48 +18,41 @@
#endregion
-#region Imports
-
using System;
+
using AopAlliance.Intercept;
+using FakeItEasy;
using NUnit.Framework;
-using Rhino.Mocks;
-using Spring.Util;
-#endregion
+using Spring.Util;
namespace Spring.Aop.Framework.Adapter
{
- ///
- /// Unit tests for the AfterReturningAdviceInterceptor class.
- ///
- /// Rod Johnson
- /// Simon White (.NET)
- [TestFixture]
- public sealed class AfterReturningAdviceInterceptorTests
- {
- [Test]
- public void PassNullAdviceToCtor()
- {
+ ///
+ /// Unit tests for the AfterReturningAdviceInterceptor class.
+ ///
+ /// Rod Johnson
+ /// Simon White (.NET)
+ [TestFixture]
+ public sealed class AfterReturningAdviceInterceptorTests
+ {
+ [Test]
+ public void PassNullAdviceToCtor()
+ {
Assert.Throws(() => new AfterReturningAdviceInterceptor(null));
- }
+ }
- [Test]
- public void IsNotInvokedIfServiceObjectThrowsException()
- {
- MockRepository repository = new MockRepository();
- IMethodInvocation mockInvocation = (IMethodInvocation)repository.CreateMock(typeof(IMethodInvocation));
- IAfterReturningAdvice mockAdvice = (IAfterReturningAdvice)repository.CreateMock(typeof(IAfterReturningAdvice));
- mockAdvice.AfterReturning(null, null, null, null);
- LastCall.IgnoreArguments();
- LastCall.Throw(new FormatException());
+ [Test]
+ public void IsNotInvokedIfServiceObjectThrowsException()
+ {
+ IMethodInvocation mockInvocation = A.Fake();
+ IAfterReturningAdvice mockAdvice = A.Fake();
- Expect.Call(mockInvocation.Method).Return(ReflectionUtils.GetMethod(typeof(object), "HashCode", new Type[] { }));
- Expect.Call(mockInvocation.Arguments).Return(null);
- Expect.Call(mockInvocation.This).Return(new object());
- Expect.Call(mockInvocation.Proceed()).Return(null);
-
- repository.ReplayAll();
+ A.CallTo(() => mockAdvice.AfterReturning(null, null, null, null)).WithAnyArguments().Throws();
+ A.CallTo(() => mockInvocation.Method).Returns(ReflectionUtils.GetMethod(typeof(object), "HashCode", new Type[] { }));
+ A.CallTo(() => mockInvocation.Arguments).Returns(null);
+ A.CallTo(() => mockInvocation.This).Returns(new object());
+ A.CallTo(() => mockInvocation.Proceed()).Returns(null);
try
{
@@ -70,29 +63,19 @@ public void IsNotInvokedIfServiceObjectThrowsException()
catch (FormatException)
{
}
-
- repository.VerifyAll();
-
- }
-
- [Test]
- public void JustPassesAfterReturningAdviceExceptionUpWithoutAnyWrapping()
- {
-
- MockRepository repository = new MockRepository();
- IMethodInvocation mockInvocation = (IMethodInvocation)repository.CreateMock(typeof(IMethodInvocation));
- IAfterReturningAdvice mockAdvice = (IAfterReturningAdvice) repository.CreateMock(typeof (IAfterReturningAdvice));
- mockAdvice.AfterReturning(null,null,null,null);
- LastCall.IgnoreArguments();
- LastCall.Throw(new FormatException());
-
- Expect.Call(mockInvocation.Method).Return(ReflectionUtils.GetMethod(typeof(object), "HashCode", new Type[] { }));
- Expect.Call(mockInvocation.Arguments).Return(null);
- Expect.Call(mockInvocation.This).Return(new object());
- Expect.Call(mockInvocation.Proceed()).Return(null);
-
- repository.ReplayAll();
-
+ }
+
+ [Test]
+ public void JustPassesAfterReturningAdviceExceptionUpWithoutAnyWrapping()
+ {
+ IMethodInvocation mockInvocation = A.Fake();
+ IAfterReturningAdvice mockAdvice = A.Fake();
+ A.CallTo(() => mockAdvice.AfterReturning(null, null, null, null)).WithAnyArguments().Throws();
+
+ A.CallTo(() => mockInvocation.Method).Returns(ReflectionUtils.GetMethod(typeof(object), "HashCode", new Type[] { }));
+ A.CallTo(() => mockInvocation.Arguments).Returns(null);
+ A.CallTo(() => mockInvocation.This).Returns(new object());
+ A.CallTo(() => mockInvocation.Proceed()).Returns(null);
try
{
AfterReturningAdviceInterceptor interceptor = new AfterReturningAdviceInterceptor(mockAdvice);
@@ -102,12 +85,6 @@ public void JustPassesAfterReturningAdviceExceptionUpWithoutAnyWrapping()
catch (FormatException)
{
}
- repository.VerifyAll();
-
-
-
-
-
- }
- }
+ }
+ }
}
\ No newline at end of file
diff --git a/test/Spring/Spring.Aop.Tests/Aop/Framework/Adapter/ThrowsAdviceInterceptorTests.cs b/test/Spring/Spring.Aop.Tests/Aop/Framework/Adapter/ThrowsAdviceInterceptorTests.cs
index 86d68e777..38c1badb5 100644
--- a/test/Spring/Spring.Aop.Tests/Aop/Framework/Adapter/ThrowsAdviceInterceptorTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aop/Framework/Adapter/ThrowsAdviceInterceptorTests.cs
@@ -18,18 +18,18 @@
#endregion
-#region Imports
-
using System;
using System.Reflection;
using System.Runtime.Remoting;
using System.Web;
+
using AopAlliance.Intercept;
+
+using FakeItEasy;
+
using NUnit.Framework;
-using Rhino.Mocks;
-using Spring.Util;
-#endregion
+using Spring.Util;
namespace Spring.Aop.Framework.Adapter
{
@@ -56,21 +56,16 @@ public void PassNullAdviceToCtor()
[Test]
public void NotInvoked()
{
- MockRepository repository = new MockRepository();
- IMethodInvocation mi = (IMethodInvocation) repository.CreateMock(typeof (IMethodInvocation));
+ IMethodInvocation mi = A.Fake();
MyThrowsHandler th = new MyThrowsHandler();
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
object ret = new object();
- Expect.Call(mi.Proceed()).Return(ret);
- repository.ReplayAll();
+ A.CallTo(() => mi.Proceed()).Returns(ret);
+
Assert.AreEqual(ret, ti.Invoke(mi));
Assert.AreEqual(0, th.GetCalls());
- repository.VerifyAll();
-
-
-
}
[Test]
@@ -81,10 +76,9 @@ public void NoHandlerMethodForThrowable()
Assert.AreEqual(2, ti.HandlerMethodCount);
Exception ex = new Exception();
- MockRepository repository = new MockRepository();
- IMethodInvocation mi = (IMethodInvocation)repository.CreateMock(typeof(IMethodInvocation));
- Expect.Call(mi.Proceed()).Throw(ex);
- repository.ReplayAll();
+ IMethodInvocation mi = A.Fake();
+ A.CallTo(() => mi.Proceed()).Throws(ex);
+
try
{
ti.Invoke(mi);
@@ -95,8 +89,6 @@ public void NoHandlerMethodForThrowable()
Assert.AreEqual(ex, caught);
}
Assert.AreEqual(0, th.GetCalls());
- repository.VerifyAll();
-
}
[Test]
@@ -107,14 +99,13 @@ public void CorrectHandlerUsed()
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
HttpException ex = new HttpException();
- MockRepository repository = new MockRepository();
- IMethodInvocation mi = (IMethodInvocation)repository.CreateMock(typeof(IMethodInvocation));
+ IMethodInvocation mi = A.Fake();
+
+ A.CallTo(() => mi.Method).Returns(ReflectionUtils.GetMethod(typeof (object), "HashCode", new Type[] {}));
+ A.CallTo(() => mi.Arguments).Returns(null);
+ A.CallTo(() => mi.This).Returns(new object());
+ A.CallTo(() => mi.Proceed()).Throws(ex);
- Expect.Call(mi.Method).Return(ReflectionUtils.GetMethod(typeof (object), "HashCode", new Type[] {}));
- Expect.Call(mi.Arguments).Return(null);
- Expect.Call(mi.This).Return(new object());
- Expect.Call(mi.Proceed()).Throw(ex);
- repository.ReplayAll();
try
{
ti.Invoke(mi);
@@ -126,9 +117,6 @@ public void CorrectHandlerUsed()
}
Assert.AreEqual(1, th.GetCalls());
Assert.AreEqual(1, th.GetCalls("HttpException"));
-
- repository.VerifyAll();
-
}
[Test]
@@ -138,10 +126,10 @@ public void NestedInnerExceptionsAreNotPickedUp()
ThrowsAdviceInterceptor throwsInterceptor = new ThrowsAdviceInterceptor(throwsHandler);
// nest the exceptions; make sure the advice gets applied because of the inner exception...
Exception exception = new FormatException("Parent", new HttpException("Inner"));
- MockRepository repository = new MockRepository();
- IMethodInvocation invocation = (IMethodInvocation)repository.CreateMock(typeof(IMethodInvocation));
- Expect.Call(invocation.Proceed()).Throw(exception);
- repository.ReplayAll();
+
+ IMethodInvocation invocation = A.Fake();
+ A.CallTo(() => invocation.Proceed()).Throws(exception);
+
try
{
throwsInterceptor.Invoke(invocation);
@@ -157,8 +145,7 @@ public void NestedInnerExceptionsAreNotPickedUp()
Assert.AreEqual(0, throwsHandler.GetCalls("HttpException"),
"Similarly, must NOT have been handled, 'cos the HttpException was wrapped by " +
"another Exception that did not have a handler.");
- repository.VerifyAll();
- }
+ }
[Test]
public void ChokesOnHandlerWhereMultipleMethodsAreApplicable()
@@ -175,10 +162,9 @@ public void CorrectHandlerUsedForSubclass()
// Extends RemotingException
RemotingTimeoutException ex = new RemotingTimeoutException();
- MockRepository repository = new MockRepository();
- IMethodInvocation mi = (IMethodInvocation)repository.CreateMock(typeof(IMethodInvocation));
- Expect.Call(mi.Proceed()).Throw(ex);
- repository.ReplayAll();
+ IMethodInvocation mi = A.Fake();
+ A.CallTo(() => mi.Proceed()).Throws(ex);
+
try
{
ti.Invoke(mi);
@@ -190,8 +176,6 @@ public void CorrectHandlerUsedForSubclass()
}
Assert.AreEqual(1, th.GetCalls());
Assert.AreEqual(1, th.GetCalls("RemotingException"));
-
- repository.VerifyAll();
}
[Test]
@@ -200,13 +184,10 @@ public void HandlerMethodThrowsException()
Exception exception = new Exception();
MyThrowsHandler handler = new ThrowingMyHandler(exception);
ThrowsAdviceInterceptor interceptor = new ThrowsAdviceInterceptor(handler);
- // extends RemotingException...
- RemotingTimeoutException ex = new RemotingTimeoutException();
- MockRepository repository = new MockRepository();
- IMethodInvocation mi = (IMethodInvocation)repository.CreateMock(typeof(IMethodInvocation));
- Expect.Call(mi.Proceed()).Throw(ex);
- repository.ReplayAll();
+ IMethodInvocation mi = A.Fake();
+ A.CallTo(() => mi.Proceed()).Throws(new RemotingTimeoutException());
+
try
{
interceptor.Invoke(mi);
@@ -217,9 +198,7 @@ public void HandlerMethodThrowsException()
Assert.AreEqual(exception, caught);
}
Assert.AreEqual(1, handler.GetCalls());
- Assert.AreEqual(1, handler.GetCalls("RemotingException"));
- repository.VerifyAll();
-
+ Assert.AreEqual(1, handler.GetCalls("RemotingException"));
}
#region Helper Classes
diff --git a/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy/AbstractAopProxyTests.cs b/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy/AbstractAopProxyTests.cs
index c7229e632..bb7485294 100644
--- a/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy/AbstractAopProxyTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy/AbstractAopProxyTests.cs
@@ -18,8 +18,6 @@
#endregion
-#region Imports
-
using System;
using System.IO;
using System.Runtime.Serialization;
@@ -32,7 +30,9 @@
using AopAlliance.Aop;
using AopAlliance.Intercept;
-using Rhino.Mocks;
+
+using FakeItEasy;
+
using Spring.Aop.Framework.Adapter;
using Spring.Aop.Interceptor;
using Spring.Aop.Support;
@@ -44,8 +44,6 @@
using NUnit.Framework;
-#endregion
-
namespace Spring.Aop.Framework.DynamicProxy
{
///
@@ -288,19 +286,19 @@ public string Company
[Test(Description = "http://jira.springframework.org/browse/SPRNET-1174")]
public void ImplementsInterfaceHierarchy()
{
- IMethodInterceptor mi = MockRepository.GenerateMock();
+ IMethodInterceptor mi = A.Fake();
- mi.Stub(x => x.Invoke(Arg.Is.NotNull)).Return((long)5).Repeat.Once();
- mi.Stub(x => x.Invoke(Arg.Is.NotNull)).Return("Customer Name").Repeat.Once();
- mi.Stub(x => x.Invoke(Arg.Is.NotNull)).Return("Customer Company").Repeat.Once();
+ A.CallTo(() => mi.Invoke(A.That.Matches(x => x.Method.Name == "get_Id"))).Returns((long) 5).Once();
+ A.CallTo(() => mi.Invoke(A.That.Matches(x => x.Method.Name == "get_Name"))).Returns("Customer Name").Once();
+ A.CallTo(() => mi.Invoke(A.That.Matches(x => x.Method.Name == "get_Company"))).Returns("Customer Company").Once();
AdvisedSupport advised = new AdvisedSupport();
advised.AddAdvice(mi);
- advised.Interfaces = new Type[] { typeof(ITestCustomer) };
+ advised.Interfaces = new[] { typeof(ITestCustomer) };
ITestCustomer to = CreateProxy(advised) as ITestCustomer;
Assert.IsNotNull(to);
- Assert.AreEqual((long)5, to.Id, "Incorrect Id");
+ Assert.AreEqual((long) 5, to.Id, "Incorrect Id");
Assert.AreEqual("Customer Name", to.Name, "Incorrect Name");
Assert.AreEqual("Customer Company", to.Company, "Incorrect Company");
}
@@ -407,8 +405,8 @@ public void NoInterceptorWithNoTarget()
public void InterceptorHandledCallWithNoTarget()
{
int age = 26;
- IMethodInterceptor mock = MockRepository.GenerateMock();
- mock.Stub(x => x.Invoke(Arg.Is.NotNull)).Return(age);
+ IMethodInterceptor mock = A.Fake();
+ A.CallTo(() => mock.Invoke(A.That.Not.IsNull())).Returns(age);
AdvisedSupport advised = new AdvisedSupport();
advised.AddAdvice(mock);
diff --git a/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy/AopUtilsTests.cs b/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy/AopUtilsTests.cs
index 7431b9021..114afaa68 100644
--- a/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy/AopUtilsTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy/AopUtilsTests.cs
@@ -18,20 +18,18 @@
#endregion
-#region Imports
-
using System;
using System.Collections;
using System.Reflection;
+
+using FakeItEasy;
+
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Aop.Interceptor;
using Spring.Aop.Support;
using Spring.Collections;
using Spring.Objects;
-#endregion
-
namespace Spring.Aop.Framework.DynamicProxy
{
///
@@ -42,12 +40,9 @@ namespace Spring.Aop.Framework.DynamicProxy
[TestFixture]
public sealed class AopUtilsTests
{
- private MockRepository mocks;
-
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
}
[Test]
@@ -80,17 +75,17 @@ public void PointcutAppliesToOneInterfaceOfSeveral()
{
IPointcut pointcut = new OneInterfaceTestPointcut();
- // Will return true if we're proxying interfaces including ITestObject
+ // Will return true if we're proxying interfaces including ITestObject
Assert.IsTrue(AopUtils.CanApply(pointcut, typeof (TestObject), new Type[] {typeof (ITestObject), typeof (IComparable)}));
- // Will return true if we're proxying interfaces including ITestObject
+ // Will return true if we're proxying interfaces including ITestObject
Assert.IsFalse(AopUtils.CanApply(pointcut, typeof (TestObject), new Type[] {typeof (IComparable)}));
}
[Test]
public void CanApplyWithAdvisorYieldsTrueIfAdvisorIsNotKnownAdvisorType()
{
- IAdvisor advisor = (IAdvisor) mocks.CreateMock(typeof (IAdvisor));
+ IAdvisor advisor = A.Fake();
Assert.IsTrue(AopUtils.CanApply(advisor, typeof (TestObject), null));
}
@@ -171,12 +166,10 @@ public void GetAllInterfacesWithObjectThatInheritsInterfaces()
[Test]
public void CanApplyWithTrueIntroductionAdvisor()
{
- IIntroductionAdvisor mockIntroAdvisor = (IIntroductionAdvisor) mocks.CreateMock(typeof(IIntroductionAdvisor));
- Expect.Call(mockIntroAdvisor.TypeFilter).Return(TrueTypeFilter.True);
- mocks.ReplayAll();
+ IIntroductionAdvisor mockIntroAdvisor = A.Fake();
+ A.CallTo(() => mockIntroAdvisor.TypeFilter).Returns(TrueTypeFilter.True);
Assert.IsTrue(AopUtils.CanApply(mockIntroAdvisor, typeof (TestObject), null));
- mocks.VerifyAll();
}
#region Helper Classes
diff --git a/test/Spring/Spring.Aop.Tests/Aop/Framework/ProxyFactoryObjectTests.cs b/test/Spring/Spring.Aop.Tests/Aop/Framework/ProxyFactoryObjectTests.cs
index 89d352bcd..f3a9ce3fd 100644
--- a/test/Spring/Spring.Aop.Tests/Aop/Framework/ProxyFactoryObjectTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aop/Framework/ProxyFactoryObjectTests.cs
@@ -31,8 +31,10 @@
using AopAlliance.Aop;
using AopAlliance.Intercept;
+
+using FakeItEasy;
+
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Aop.Advice;
using Spring.Aop.Framework.Adapter;
using Spring.Aop.Interceptor;
@@ -61,17 +63,14 @@ namespace Spring.Aop.Framework
[TestFixture]
public sealed class ProxyFactoryObjectTests
{
- private MockRepository mocks;
private IObjectFactory factory;
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
factory = new XmlObjectFactory(new ReadOnlyXmlTestResource("proxyFactoryTests.xml", GetType()));
}
-
[Test]
public void TargetThrowsInvalidCastException()
{
@@ -477,9 +476,8 @@ public void GlobalsCanAddAspectInterfaces()
public void IsSingletonFalseReturnsNew_ProxyInstance_NotNewProxyTargetSource()
{
GoodCommand target = new GoodCommand();
- IObjectFactory mock = (IObjectFactory) mocks.CreateMock(typeof(IObjectFactory));
- Expect.Call(mock.GetObject("singleton")).Return(target).Repeat.Twice();
- mocks.ReplayAll();
+ IObjectFactory mock = A.Fake();
+ A.CallTo(() => mock.GetObject("singleton")).Returns(target).Twice();
ProxyFactoryObject fac = new ProxyFactoryObject();
fac.ProxyInterfaces = new string[] { typeof(ICommand).FullName };
@@ -491,17 +489,14 @@ public void IsSingletonFalseReturnsNew_ProxyInstance_NotNewProxyTargetSource()
ICommand one = (ICommand)fac.GetObject();
ICommand two = (ICommand)fac.GetObject();
Assert.IsFalse(ReferenceEquals(one, two));
-
- mocks.VerifyAll();
}
[Test]
public void IsSingletonTrueReturnsNew_ProxyInstance_NotNewProxyTargetSource()
{
GoodCommand target = new GoodCommand();
- IObjectFactory mock = (IObjectFactory)mocks.CreateMock(typeof(IObjectFactory));
- Expect.Call(mock.GetObject("singleton")).Return(target);
- mocks.ReplayAll();
+ IObjectFactory mock = A.Fake();
+ A.CallTo(() => mock.GetObject("singleton")).Returns(target);
ProxyFactoryObject fac = new ProxyFactoryObject();
fac.ProxyInterfaces = new string[] { typeof(ICommand).FullName };
@@ -513,8 +508,6 @@ public void IsSingletonTrueReturnsNew_ProxyInstance_NotNewProxyTargetSource()
ICommand one = (ICommand)fac.GetObject();
ICommand two = (ICommand)fac.GetObject();
Assert.IsTrue(ReferenceEquals(one, two));
-
- mocks.VerifyAll();
}
private ProxyFactoryObject CreateFrozenProxyFactory()
@@ -562,11 +555,10 @@ public void TargetAtEndOfInterceptorList()
GoodCommand target = new GoodCommand();
NopInterceptor advice = new NopInterceptor();
- IObjectFactory mock = (IObjectFactory) mocks.CreateMock(typeof(IObjectFactory));
- Expect.Call(mock.GetObject("advice")).Return(advice);
- Expect.Call(mock.GetObject("singleton")).Return(target);
- Expect.Call(mock.GetType("singleton")).Return(typeof(GoodCommand));
- mocks.ReplayAll();
+ IObjectFactory mock = A.Fake();
+ A.CallTo(() => mock.GetObject("advice")).Returns(advice);
+ A.CallTo(() => mock.GetObject("singleton")).Returns(target);
+ A.CallTo(() => mock.GetType("singleton")).Returns(typeof(GoodCommand));
ProxyFactoryObject fac = new ProxyFactoryObject();
fac.ProxyInterfaces = new string[] { typeof(ICommand).FullName };
@@ -581,8 +573,6 @@ public void TargetAtEndOfInterceptorList()
Assert.AreEqual(1, advice.Count);
two.Execute();
Assert.AreEqual(2, advice.Count);
-
- mocks.VerifyAll();
}
[Test]
@@ -591,32 +581,20 @@ public void MakeSurePrototypeTargetIsNotNeedlesslyCreatedDuringInitialization_Un
GoodCommand target = new GoodCommand();
NopInterceptor advice = new NopInterceptor();
- MockRepository mocks = new MockRepository();
- IObjectFactory factory = (IObjectFactory) mocks.CreateMock(typeof(IObjectFactory));
+ IObjectFactory factory = A.Fake();
ProxyFactoryObject fac = new ProxyFactoryObject();
- fac.ProxyInterfaces = new string[] { typeof(ICommand).FullName };
+ fac.ProxyInterfaces = new[] {typeof(ICommand).FullName};
fac.IsSingleton = false;
- fac.InterceptorNames = new string[] { "advice", "prototype" };
+ fac.InterceptorNames = new[] {"advice", "prototype"};
fac.ObjectFactory = factory;
-// using (mocks.Record())
- {
- using (mocks.Unordered())
- {
- Expect.Call(factory.IsSingleton("advice")).Return(true);
- Expect.Call(factory.GetObject("advice")).Return(advice);
- Expect.Call(factory.GetType("prototype")).Return(target.GetType());
- Expect.Call(factory.GetObject("prototype")).Return(target);
- }
- }
- mocks.ReplayAll();
+ A.CallTo(() => factory.IsSingleton("advice")).Returns(true);
+ A.CallTo(() => factory.GetObject("advice")).Returns(advice);
+ A.CallTo(() => factory.GetType("prototype")).Returns(target.GetType());
+ A.CallTo(() => factory.GetObject("prototype")).Returns(target);
-// using(mocks.Playback())
- {
- fac.GetObject();
- }
- mocks.VerifyAll();
+ fac.GetObject();
}
[Test]
@@ -706,26 +684,20 @@ public void Execute()
[Test]
public void NullNameInInterceptorNamesArrayThrowAopConfigException()
{
- IObjectFactory factory = (IObjectFactory) mocks.CreateMock(typeof(IObjectFactory));
+ IObjectFactory factory = A.Fake();
ProxyFactoryObject fac = new ProxyFactoryObject();
fac.ProxyInterfaces = new string[] { typeof(ICommand).FullName };
fac.IsSingleton = false;
fac.InterceptorNames = new string[] { null, null };
fac.ObjectFactory = factory;
- try
- {
- fac.GetObject();
- Assert.Fail();
- }
- catch (AopConfigException)
- {}
+ Assert.Throws(() => fac.GetObject());
}
[Test]
public void PassEmptyInterceptorNamesArray_WithTargetThatImplementsAnInterfaceCanBeCastToSaidInterface()
{
- IObjectFactory factory = (IObjectFactory) mocks.CreateMock(typeof(IObjectFactory));
+ IObjectFactory factory = A.Fake();
ProxyFactoryObject fac = new ProxyFactoryObject();
fac.ProxyInterfaces = new string[] { };
diff --git a/test/Spring/Spring.Aop.Tests/Aop/Framework/ProxyFactoryTests.cs b/test/Spring/Spring.Aop.Tests/Aop/Framework/ProxyFactoryTests.cs
index 7987ea7d4..cc54de186 100644
--- a/test/Spring/Spring.Aop.Tests/Aop/Framework/ProxyFactoryTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aop/Framework/ProxyFactoryTests.cs
@@ -18,21 +18,19 @@
#endregion
-#region Imports
-
using System;
using System.Runtime.Serialization;
using AopAlliance.Aop;
using AopAlliance.Intercept;
+
+using FakeItEasy;
+
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Aop.Interceptor;
using Spring.Aop.Support;
using Spring.Objects;
using Spring.Util;
-#endregion
-
namespace Spring.Aop.Framework
{
///
@@ -44,15 +42,6 @@ namespace Spring.Aop.Framework
[TestFixture]
public sealed class ProxyFactoryTests
{
-
- private MockRepository mocks;
-
- [SetUp]
- public void Setup()
- {
- mocks = new MockRepository();
- }
-
public interface IDoubleClickable
{
event EventHandler DoubleClick;
@@ -132,7 +121,7 @@ public void CacheTest()
object proxy = pf.GetProxy();
}
- // fails when running in resharper/testdriven.net
+ // fails when running in resharper/testdriven.net
// DynamicProxyManager.SaveAssembly();
}
@@ -523,24 +512,21 @@ public void AddAdvisedSupportListener()
//MLP SPRNET-1367
//IDynamicMock mock = new DynamicMock(typeof(IAdvisedSupportListener));
//IAdvisedSupportListener listener = (IAdvisedSupportListener)mock.Object;
- IAdvisedSupportListener listener =
- (IAdvisedSupportListener) mocks.CreateMock(typeof (IAdvisedSupportListener));
- listener.Activated(null);
- LastCall.On(listener).IgnoreArguments();
+ IAdvisedSupportListener listener = A.Fake();
//listener.Activated();
//mock.Expect("Activated");
- mocks.ReplayAll();
ProxyFactory factory = new ProxyFactory(new TestObject());
factory.AddListener(listener);
factory.GetProxy();
- mocks.VerifyAll();
+
+ A.CallTo(() => listener.Activated(A._)).MustHaveHappened();
}
[Test]
public void AdvisedSupportListenerMethodsAreCalledAppropriately()
{
- IAdvisedSupportListener listener = MockRepository.GenerateMock();
+ IAdvisedSupportListener listener = A.Fake();
ProxyFactory factory = new ProxyFactory(new TestObject());
factory.AddListener(listener);
@@ -552,15 +538,15 @@ public void AdvisedSupportListenerMethodsAreCalledAppropriately()
// must fire the InterfacesChanged callback...
factory.AddInterface(typeof(ISerializable));
- listener.AssertWasCalled(x => x.Activated(Arg.Is.NotNull));
- listener.AssertWasCalled(x => x.AdviceChanged(Arg.Is.NotNull));
- listener.AssertWasCalled(x => x.InterfacesChanged(Arg.Is.NotNull));
+ A.CallTo(() => listener.Activated(A.That.Not.IsNull())).MustHaveHappened();
+ A.CallTo(() => listener.AdviceChanged(A.That.Not.IsNull())).MustHaveHappened();
+ A.CallTo(() => listener.InterfacesChanged(A.That.Not.IsNull())).MustHaveHappened();
}
[Test]
public void AdvisedSupportListenerMethodsAre_NOT_CalledIfProxyHasNotBeenCreated()
{
- IAdvisedSupportListener listener = MockRepository.GenerateMock();
+ IAdvisedSupportListener listener = A.Fake();
ProxyFactory factory = new ProxyFactory(new TestObject());
factory.AddListener(listener);
@@ -570,8 +556,8 @@ public void AdvisedSupportListenerMethodsAre_NOT_CalledIfProxyHasNotBeenCreated(
// must not fire the InterfacesChanged callback...
factory.AddInterface(typeof(ISerializable));
- listener.AssertWasNotCalled(x => x.AdviceChanged(Arg.Is.Anything));
- listener.AssertWasNotCalled(x => x.InterfacesChanged(Arg.Is.Anything));
+ A.CallTo(() => listener.AdviceChanged(A._)).MustNotHaveHappened();
+ A.CallTo(() => listener.InterfacesChanged(A._)).MustNotHaveHappened();
}
[Test]
@@ -591,7 +577,7 @@ public void RemoveNullAdvisedSupportListenerIsOk()
[Test]
public void RemoveAdvisedSupportListener()
{
- IAdvisedSupportListener listener = MockRepository.GenerateMock();
+ IAdvisedSupportListener listener = A.Fake();
ProxyFactory factory = new ProxyFactory(new TestObject());
factory.AddListener(listener);
@@ -600,9 +586,9 @@ public void RemoveAdvisedSupportListener()
factory.GetProxy();
// check that no lifecycle callback methods were invoked on the listener...
- listener.AssertWasNotCalled(x => x.Activated(Arg.Is.Anything));
- listener.AssertWasNotCalled(x => x.AdviceChanged(Arg.Is.Anything));
- listener.AssertWasNotCalled(x => x.InterfacesChanged(Arg.Is.Anything));
+ A.CallTo(() => listener.Activated(null)).WithAnyArguments().MustNotHaveHappened();
+ A.CallTo(() => listener.AdviceChanged(null)).WithAnyArguments().MustNotHaveHappened();
+ A.CallTo(() => listener.InterfacesChanged(null)).WithAnyArguments().MustNotHaveHappened();
}
[Test]
@@ -657,7 +643,7 @@ public void NestedProxiesDontInvokeSameAdviceOrIntroductionTwice()
NopInterceptor diUnused = new NopInterceptor(1); // // make instance unique (see SPRNET-847)
TestCountingIntroduction countingMixin = new TestCountingIntroduction();
- pf1.AddAdvice(diUnused);
+ pf1.AddAdvice(diUnused);
pf1.AddAdvisor(new DefaultPointcutAdvisor(di));
pf1.AddIntroduction(new DefaultIntroductionAdvisor(countingMixin));
diff --git a/test/Spring/Spring.Aop.Tests/Aop/Support/DelegatingIntroductionInterceptorTests.cs b/test/Spring/Spring.Aop.Tests/Aop/Support/DelegatingIntroductionInterceptorTests.cs
index 0fe68b0b8..b14c4d630 100644
--- a/test/Spring/Spring.Aop.Tests/Aop/Support/DelegatingIntroductionInterceptorTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aop/Support/DelegatingIntroductionInterceptorTests.cs
@@ -1,13 +1,13 @@
#region License
/*
* Copyright 2002-2010 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,14 +16,14 @@
*/
#endregion
-#region Imports
using System;
using NUnit.Framework;
using AopAlliance.Aop;
-using Rhino.Mocks;
+
+using FakeItEasy;
+
using Spring.Aop.Framework;
using Spring.Objects;
-#endregion
namespace Spring.Aop.Support
{
@@ -58,9 +58,9 @@ public void TestIntroductionInterceptorWithDelegation()
TestObject raw = new TestObject();
Assert.IsTrue(! (raw is ITimeStamped));
ProxyFactory factory = new ProxyFactory(raw);
-
- ITimeStampedIntroduction ts = MockRepository.GenerateMock();
- ts.Stub(x => x.TimeStamp).Return(EXPECTED_TIMESTAMP);
+
+ ITimeStampedIntroduction ts = A.Fake();
+ A.CallTo(() => ts.TimeStamp).Returns(EXPECTED_TIMESTAMP);
DefaultIntroductionAdvisor advisor = new DefaultIntroductionAdvisor(ts);
factory.AddIntroduction(advisor);
@@ -74,17 +74,18 @@ public void TestIntroductionInterceptorWithDelegation()
public interface ISubTimeStampedIntroduction: ISubTimeStamped, IAdvice
{
}
-
- public void TestIntroductionInterceptorWithInterfaceHierarchy()
+
+ [Test]
+ public void TestIntroductionInterceptorWithInterfaceHierarchy()
{
TestObject raw = new TestObject();
Assert.IsTrue(! (raw is ISubTimeStamped));
ProxyFactory factory = new ProxyFactory(raw);
- ISubTimeStampedIntroduction ts = MockRepository.GenerateMock();
- ts.Stub(x => x.TimeStamp).Return(EXPECTED_TIMESTAMP);
+ ISubTimeStampedIntroduction ts = A.Fake();
+ A.CallTo(() => ts.TimeStamp).Returns(EXPECTED_TIMESTAMP);
- DefaultIntroductionAdvisor advisor = new DefaultIntroductionAdvisor(ts);
+ DefaultIntroductionAdvisor advisor = new DefaultIntroductionAdvisor(ts);
// we must add introduction, not an advisor
factory.AddIntroduction(advisor);
@@ -93,17 +94,18 @@ public void TestIntroductionInterceptorWithInterfaceHierarchy()
Assert.IsTrue(tsp.TimeStamp == EXPECTED_TIMESTAMP);
}
- public void TestIntroductionInterceptorWithSuperInterface()
+ [Test]
+ public void TestIntroductionInterceptorWithSuperInterface()
{
TestObject raw = new TestObject();
Assert.IsTrue(! (raw is ITimeStamped));
ProxyFactory factory = new ProxyFactory(raw);
- ISubTimeStamped ts = MockRepository.GenerateMock();
- ts.Stub(x => x.TimeStamp).Return(EXPECTED_TIMESTAMP);
+ ISubTimeStampedIntroduction ts = A.Fake();
+ A.CallTo(() => ts.TimeStamp).Returns(EXPECTED_TIMESTAMP);
- factory.AddIntroduction(0, new DefaultIntroductionAdvisor(
- (ISubTimeStampedIntroduction)ts,
+ factory.AddIntroduction(0, new DefaultIntroductionAdvisor(
+ ts,
typeof(ITimeStamped))
);
@@ -121,42 +123,42 @@ private class Test : ITimeStamped, ITest, IAdvice
{
private DateTime _timestamp;
- public Test(DateTime timestamp)
+ public Test(DateTime timestamp)
{
_timestamp = timestamp;
}
- public void Foo()
+ public void Foo()
{
}
- public DateTime TimeStamp
+ public DateTime TimeStamp
{
- get
+ get
{
return _timestamp;
}
}
}
- public void TestAutomaticInterfaceRecognitionInDelegate()
+ public void TestAutomaticInterfaceRecognitionInDelegate()
{
IIntroductionAdvisor ia = new DefaultIntroductionAdvisor(new Test(EXPECTED_TIMESTAMP));
-
+
TestObject target = new TestObject();
ProxyFactory pf = new ProxyFactory(target);
pf.AddIntroduction(0, ia);
ITimeStamped ts = (ITimeStamped) pf.GetProxy();
-
+
Assert.IsTrue(ts.TimeStamp == EXPECTED_TIMESTAMP);
((ITest) ts).Foo();
-
+
int age = ((ITestObject) ts).Age;
}
/*
* The rest of the tests in the original tested subclassing the
* DelegatingIntroductionInterceptor.
- *
+ *
* Since we don't need to subclass anything to make a delegating
* introduction, the rest of the tests are not necessary.
*/
@@ -164,12 +166,12 @@ public void TestAutomaticInterfaceRecognitionInDelegate()
// must be public to be used for AOP
// AOP creates a new assembly which must have access to the
// interfaces that it intends to expose.
- public interface ITest
+ public interface ITest
{
void Foo();
}
- public interface ISubTimeStamped : ITimeStamped
+ public interface ISubTimeStamped : ITimeStamped
{
}
diff --git a/test/Spring/Spring.Aop.Tests/Aop/Target/PrototypeTargetSourceTests.cs b/test/Spring/Spring.Aop.Tests/Aop/Target/PrototypeTargetSourceTests.cs
index 6e09f7f06..151af21cc 100644
--- a/test/Spring/Spring.Aop.Tests/Aop/Target/PrototypeTargetSourceTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aop/Target/PrototypeTargetSourceTests.cs
@@ -18,17 +18,17 @@
#endregion
-#region Imports
-
using System;
+
using Common.Logging;
using Common.Logging.Simple;
+
+using FakeItEasy;
+
using NUnit.Framework;
+
using Spring.Objects.Factory;
using Spring.Objects.Factory.Xml;
-using Rhino.Mocks;
-
-#endregion
namespace Spring.Aop.Target
{
@@ -79,24 +79,16 @@ public void PrototypeAndSingletonBehaveDifferently()
[Test]
public void TargetType()
{
- MockRepository mocks = new MockRepository();
SideEffectObject target = new SideEffectObject();
- IObjectFactory factory = mocks.CreateMock();
-
- using (mocks.Record())
- {
- Expect.Call(factory.IsPrototype(null)).Return(true);
- Expect.Call(factory.GetType(null)).Return(typeof(SideEffectObject));
- }
+ IObjectFactory factory = A.Fake();
- using (mocks.Playback())
- {
- PrototypeTargetSource source = new PrototypeTargetSource();
- source.ObjectFactory = factory;
- Assert.AreEqual(target.GetType(), source.TargetType, "Wrong TargetType being returned.");
- }
+ A.CallTo(() => factory.IsPrototype(null)).Returns(true);
+ A.CallTo(() => factory.GetType(null)).Returns(typeof(SideEffectObject));
+ PrototypeTargetSource source = new PrototypeTargetSource();
+ source.ObjectFactory = factory;
+ Assert.AreEqual(target.GetType(), source.TargetType, "Wrong TargetType being returned.");
}
[Test]
@@ -109,49 +101,30 @@ public void IsStatic()
[Test]
public void WithNonSingletonTargetObject()
{
- MockRepository mocks = new MockRepository();
-
- IObjectFactory factory = mocks.CreateMock();
+ IObjectFactory factory = A.Fake();
const string objectName = "Foo";
- using (mocks.Record())
- {
- Expect.Call(factory.IsPrototype(objectName)).Return(false);
- }
-
- using (mocks.Playback())
- {
- PrototypeTargetSource source = new PrototypeTargetSource();
- source.TargetObjectName = objectName;
+ A.CallTo(() => factory.IsPrototype(objectName)).Returns(false);
+ PrototypeTargetSource source = new PrototypeTargetSource();
+ source.TargetObjectName = objectName;
- Assert.Throws(delegate { source.ObjectFactory = factory; });
- }
+ Assert.Throws(delegate { source.ObjectFactory = factory; });
}
[Test]
public void GetTarget()
{
- MockRepository mocks = new MockRepository();
-
- IObjectFactory factory = mocks.CreateMock();
+ IObjectFactory factory = A.Fake();
SideEffectObject target = new SideEffectObject();
+ A.CallTo(() => factory.IsPrototype("foo")).Returns(true);
+ A.CallTo(() => factory.GetObject("foo")).Returns(target);
+ A.CallTo(() => factory.GetType("foo")).Returns(typeof(string));
- using (mocks.Record())
- {
- Expect.Call(factory.IsPrototype("foo")).Return(true);
- Expect.Call(factory.GetObject("foo")).Return(target);
- Expect.Call(factory.GetType("foo")).Return(typeof(string));
- }
-
- using (mocks.Playback())
- {
- PrototypeTargetSource source = new PrototypeTargetSource();
- source.TargetObjectName = "foo";
- source.ObjectFactory = factory;
- Assert.IsTrue(object.ReferenceEquals(source.GetTarget(), target),
- "Initial target source reference not being returned by GetTarget().");
- }
-
+ PrototypeTargetSource source = new PrototypeTargetSource();
+ source.TargetObjectName = "foo";
+ source.ObjectFactory = factory;
+ Assert.IsTrue(object.ReferenceEquals(source.GetTarget(), target),
+ "Initial target source reference not being returned by GetTarget().");
}
[Test]
diff --git a/test/Spring/Spring.Aop.Tests/Aspects/Cache/CacheParameterAdviceTests.cs b/test/Spring/Spring.Aop.Tests/Aspects/Cache/CacheParameterAdviceTests.cs
index 86c677e23..ec3f9e056 100644
--- a/test/Spring/Spring.Aop.Tests/Aspects/Cache/CacheParameterAdviceTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aspects/Cache/CacheParameterAdviceTests.cs
@@ -18,17 +18,15 @@
#endregion
-#region Imports
-
using System;
using System.Reflection;
+
+using FakeItEasy;
+
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Caching;
using Spring.Context;
-#endregion
-
namespace Spring.Aspects.Cache
{
///
@@ -38,7 +36,6 @@ namespace Spring.Aspects.Cache
[TestFixture]
public sealed class CacheParameterAdviceTests
{
- private MockRepository mocks;
private IApplicationContext mockContext;
private CacheParameterAdvice advice;
private ICache cache;
@@ -46,8 +43,7 @@ public sealed class CacheParameterAdviceTests
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
- mockContext = (IApplicationContext) mocks.CreateMock(typeof (IApplicationContext));
+ mockContext = A.Fake();
advice = new CacheParameterAdvice();
advice.ApplicationContext = mockContext;
@@ -62,14 +58,11 @@ public void TestSimpleParameterCaching()
object[] args = new object[] {new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian")};
ExpectCacheInstanceRetrieval("cache", cache);
- mocks.ReplayAll();
// parameter value should be added to cache
advice.AfterReturning(null, method, args, null);
Assert.AreEqual(1, cache.Count);
Assert.AreEqual(args[0], cache.Get("Nikola Tesla"));
-
- mocks.VerifyAll();
}
[Test]
@@ -79,14 +72,11 @@ public void TestSimpleWithMethodInfoParameterCaching()
object[] args = new object[] { new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian") };
ExpectCacheInstanceRetrieval("cache", cache);
- mocks.ReplayAll();
// parameter value should be added to cache
advice.AfterReturning(null, method, args, null);
Assert.AreEqual(1, cache.Count);
Assert.AreEqual(args[0], cache.Get("Save-Nikola Tesla"));
-
- mocks.VerifyAll();
}
[Test]
@@ -96,16 +86,13 @@ public void TestMultipleParameterCaching()
object[] args = new object[] { new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian") };
ExpectCacheInstanceRetrieval("cache", cache);
- ExpectCacheInstanceRetrieval("cache", cache);
- mocks.ReplayAll();
+ ExpectCacheInstanceRetrieval("cache", cache);
// parameter value should be added to both cache
advice.AfterReturning(null, method, args, null);
Assert.AreEqual(2, cache.Count);
Assert.AreEqual(args[0], cache.Get("Nikola Tesla"));
Assert.AreEqual(args[0], cache.Get("Serbian"));
-
- mocks.VerifyAll();
}
[Test]
@@ -119,18 +106,12 @@ public void TestConditionParameterCaching()
Assert.AreEqual(0, cache.Count);
}
- #region Helper methods
-
private void ExpectCacheInstanceRetrieval(string cacheName, ICache cacheToReturn)
{
- Expect.Call(mockContext.GetObject(cacheName)).Return(cacheToReturn);
+ A.CallTo(() => mockContext.GetObject(cacheName)).Returns(cacheToReturn).Once();
}
-
- #endregion
}
- #region Inner Class : CacheParameterTarget
-
public interface ICacheParameterTarget
{
void Save(Inventor inventor);
@@ -163,6 +144,4 @@ public void Save([CacheParameter("cache", "Name", Condition = "Nationality == 'F
{
}
}
-
- #endregion
}
\ No newline at end of file
diff --git a/test/Spring/Spring.Aop.Tests/Aspects/Cache/CacheResultAdviceTests.cs b/test/Spring/Spring.Aop.Tests/Aspects/Cache/CacheResultAdviceTests.cs
index b3060b652..8aac6ea1e 100644
--- a/test/Spring/Spring.Aop.Tests/Aspects/Cache/CacheResultAdviceTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aspects/Cache/CacheResultAdviceTests.cs
@@ -18,20 +18,18 @@
#endregion
-#region Imports
-
using System.Collections;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using AopAlliance.Intercept;
-using Rhino.Mocks;
+
+using FakeItEasy;
+
using NUnit.Framework;
using Spring.Caching;
using Spring.Context;
-#endregion
-
namespace Spring.Aspects.Cache
{
///
@@ -50,14 +48,12 @@ public sealed class CacheResultAdviceTests
private ICache itemCache;
private ICache binaryFormatterCache;
private CacheResultTarget cacheResultTarget = new CacheResultTarget();
- private MockRepository mocks;
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
- mockInvocation = mocks.CreateMock();
- mockContext = mocks.CreateMock();
+ mockInvocation = A.Fake();
+ mockContext = A.Fake();
advice = new CacheResultAdvice();
advice.ApplicationContext = mockContext;
@@ -77,24 +73,16 @@ public void CacheResultOfMethodThatReturnsNull()
MethodInfo method = new VoidMethod(cacheResultTarget.ReturnsNothing).Method;
object expectedReturnValue = null;
- using (mocks.Record())
- {
- ExpectAttributeRetrieval(method);
- ExpectCacheKeyGeneration(method, null);
- ExpectCacheInstanceRetrieval("results", resultCache);
- ExpectCallToProceed(expectedReturnValue);
- }
-
- using (mocks.Playback())
- {
- // check that the null retVal is cached as well - it might be
- // the result of an expensive webservice/database call etc.
- object returnValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, returnValue);
- Assert.AreEqual(1, resultCache.Count);
- }
-
+ ExpectAttributeRetrieval(method);
+ ExpectCacheKeyGeneration(method, null);
+ ExpectCacheInstanceRetrieval("results", resultCache);
+ ExpectCallToProceed(expectedReturnValue);
+ // check that the null retVal is cached as well - it might be
+ // the result of an expensive webservice/database call etc.
+ object returnValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, returnValue);
+ Assert.AreEqual(1, resultCache.Count);
}
[Test]
@@ -103,26 +91,20 @@ public void CacheResultOfMethodThatReturnsNullWithSerializingCache()
MethodInfo method = new VoidMethod(cacheResultTarget.ReturnsNothing).Method;
object expectedReturnValue = null;
- using (mocks.Record())
- {
- ExpectAttributeRetrieval(method);
- ExpectCacheKeyGeneration(method, null);
- ExpectCacheInstanceRetrieval("results", binaryFormatterCache);
- ExpectCallToProceed(expectedReturnValue);
- }
+ ExpectAttributeRetrieval(method);
+ ExpectCacheKeyGeneration(method, null);
+ ExpectCacheInstanceRetrieval("results", binaryFormatterCache);
+ ExpectCallToProceed(expectedReturnValue);
- using (mocks.Playback())
- {
- // check that the null retVal is cached as well - it might be
- // the result of an expensive webservice/database call etc.
- object returnValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, returnValue);
- Assert.AreEqual(1, binaryFormatterCache.Count);
-
- // cached value should be returned
- object cachedValue = advice.Invoke(mockInvocation);
- Assert.IsNull(cachedValue, "Should recognize cached value as null-value marker.");
- }
+ // check that the null retVal is cached as well - it might be
+ // the result of an expensive webservice/database call etc.
+ object returnValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, returnValue);
+ Assert.AreEqual(1, binaryFormatterCache.Count);
+
+ // cached value should be returned
+ object cachedValue = advice.Invoke(mockInvocation);
+ Assert.IsNull(cachedValue, "Should recognize cached value as null-value marker.");
}
[Test]
@@ -131,96 +113,76 @@ public void CacheResultOfMethodThatReturnsObject()
MethodInfo method = new IntMethod(cacheResultTarget.ReturnsScalar).Method;
object expectedReturnValue = CacheResultTarget.Scalar;
- using (mocks.Record())
- {
- ExpectAttributeRetrieval(method);
- ExpectCacheKeyGeneration(method, null);
- ExpectCacheInstanceRetrieval("results", resultCache);
- ExpectCallToProceed(expectedReturnValue);
- }
+ ExpectAttributeRetrieval(method);
+ ExpectCacheKeyGeneration(method, null);
+ ExpectCacheInstanceRetrieval("results", resultCache);
+ ExpectCallToProceed(expectedReturnValue);
- using (mocks.Playback())
- {
- // return value should be added to cache
- object returnValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, returnValue);
- Assert.AreEqual(1, resultCache.Count);
-
- // cached value should be returned
- object cachedValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, cachedValue);
- Assert.AreEqual(1, resultCache.Count);
- Assert.AreSame(returnValue, cachedValue);
- }
+ // return value should be added to cache
+ object returnValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, returnValue);
+ Assert.AreEqual(1, resultCache.Count);
+
+ // cached value should be returned
+ object cachedValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, cachedValue);
+ Assert.AreEqual(1, resultCache.Count);
+ Assert.AreSame(returnValue, cachedValue);
}
[Test]
public void CacheResultOfMethodThatReturnsCollection()
{
MethodInfo method = new EnumerableResultMethod(cacheResultTarget.ReturnsCollection).Method;
- object expectedReturnValue = new object[] { "one", "two", "three" };
+ object expectedReturnValue = new object[] {"one", "two", "three"};
- using (mocks.Record())
- {
- ExpectAttributeRetrieval(method);
- ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
- ExpectCacheInstanceRetrieval("results", resultCache);
- ExpectCallToProceed(new object[] { "one", "two", "three" });
- }
+ ExpectAttributeRetrieval(method);
+ ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
+ ExpectCacheInstanceRetrieval("results", resultCache);
+ ExpectCallToProceed(new object[] {"one", "two", "three"});
- using (mocks.Playback())
- {
- // return value should be added to cache
- object returnValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, returnValue);
- Assert.AreEqual(1, resultCache.Count);
-
- // cached value should be returned
- object cachedValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, cachedValue);
- Assert.AreNotSame(expectedReturnValue, cachedValue);
- Assert.AreEqual(expectedReturnValue, resultCache.Get(5));
- Assert.AreEqual(1, resultCache.Count);
- Assert.AreSame(returnValue, cachedValue);
- Assert.AreSame(cachedValue, resultCache.Get(5));
- }
+ // return value should be added to cache
+ object returnValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, returnValue);
+ Assert.AreEqual(1, resultCache.Count);
+
+ // cached value should be returned
+ object cachedValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, cachedValue);
+ Assert.AreNotSame(expectedReturnValue, cachedValue);
+ Assert.AreEqual(expectedReturnValue, resultCache.Get(5));
+ Assert.AreEqual(1, resultCache.Count);
+ Assert.AreSame(returnValue, cachedValue);
+ Assert.AreSame(cachedValue, resultCache.Get(5));
}
[Test]
public void CacheResultAndItemsOfMethodThatReturnsCollection()
{
MethodInfo method = new EnumerableResultMethod(cacheResultTarget.ReturnsCollectionAndItems).Method;
- object expectedReturnValue = new object[] { "one", "two", "three" };
+ object expectedReturnValue = new object[] {"one", "two", "three"};
- using (mocks.Record())
- {
- ExpectAttributeRetrieval(method);
- ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
- ExpectCacheInstanceRetrieval("results", resultCache);
- ExpectCallToProceed(new object[] { "one", "two", "three" });
- ExpectCacheInstanceRetrieval("items", itemCache);
-
- }
+ ExpectAttributeRetrieval(method);
+ ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
+ ExpectCacheInstanceRetrieval("results", resultCache);
+ ExpectCallToProceed(new object[] {"one", "two", "three"});
+ ExpectCacheInstanceRetrieval("items", itemCache);
- using (mocks.Playback())
- {
- // return value should be added to result cache and each item to item cache
- object returnValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, returnValue);
- Assert.AreEqual(1, resultCache.Count);
- Assert.AreEqual(3, itemCache.Count);
-
- // cached value should be returned
- object cachedValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, cachedValue);
- Assert.AreNotSame(expectedReturnValue, cachedValue);
- Assert.AreEqual(expectedReturnValue, resultCache.Get(5));
- Assert.AreEqual(1, resultCache.Count);
- Assert.AreEqual(3, itemCache.Count);
- Assert.AreSame(returnValue, cachedValue);
- Assert.AreSame(cachedValue, resultCache.Get(5));
+ // return value should be added to result cache and each item to item cache
+ object returnValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, returnValue);
+ Assert.AreEqual(1, resultCache.Count);
+ Assert.AreEqual(3, itemCache.Count);
- }
+ // cached value should be returned
+ object cachedValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, cachedValue);
+ Assert.AreNotSame(expectedReturnValue, cachedValue);
+ Assert.AreEqual(expectedReturnValue, resultCache.Get(5));
+ Assert.AreEqual(1, resultCache.Count);
+ Assert.AreEqual(3, itemCache.Count);
+ Assert.AreSame(returnValue, cachedValue);
+ Assert.AreSame(cachedValue, resultCache.Get(5));
}
[Test]
@@ -229,74 +191,51 @@ public void CacheOnlyItemsOfMethodThatReturnsCollection()
MethodInfo method = new EnumerableResultMethod(cacheResultTarget.ReturnsItems).Method;
object expectedReturnValue = new object[] { "one", "two", "three" };
- mocks.Record();
-
ExpectAttributeRetrieval(method);
ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
ExpectCallToProceed(new object[] { "one", "two", "three" });
ExpectCacheInstanceRetrieval("items", itemCache);
- mocks.ReplayAll();
-
// return value should be added to result cache and each item to item cache
object returnValue = advice.Invoke(mockInvocation);
Assert.AreEqual(expectedReturnValue, returnValue);
Assert.AreEqual(0, resultCache.Count);
Assert.AreEqual(3, itemCache.Count);
- mocks.Verify(mockInvocation);
-
- mocks.BackToRecord(mockInvocation);
-
ExpectAttributeRetrieval(method);
ExpectCallToProceed(new object[] { "one", "two", "three" });
ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
- mocks.Replay(mockInvocation);
-
object newReturnValue = advice.Invoke(mockInvocation);
Assert.AreEqual(expectedReturnValue, newReturnValue);
Assert.AreEqual(0, resultCache.Count);
Assert.AreEqual(3, itemCache.Count);
Assert.AreEqual("two", itemCache.Get("two"));
Assert.AreNotSame(returnValue, newReturnValue);
-
- mocks.VerifyAll();
}
-
[Test]
public void CacheOnlyItemsOfMethodThatReturnsCollectionWithinTwoDifferentCaches()
{
MethodInfo method = new EnumerableResultMethod(cacheResultTarget.MultipleCacheResultItems).Method;
object expectedReturnValue = new object[] { "one", "two", "three" };
- mocks.Record();
-
ExpectAttributeRetrieval(method);
ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
ExpectCallToProceed(new object[] { "one", "two", "three" });
ExpectCacheInstanceRetrieval("items", itemCache);
- mocks.ReplayAll();
-
// return value should be added to result cache and each item to item cache
object returnValue = advice.Invoke(mockInvocation);
Assert.AreEqual(expectedReturnValue, returnValue);
Assert.AreEqual(0, resultCache.Count);
Assert.AreEqual(6, itemCache.Count);
- mocks.Verify(mockInvocation);
-
- mocks.BackToRecord(mockInvocation);
-
// and again, but without Proceed() and item cache access...
ExpectAttributeRetrieval(method);
ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
ExpectCallToProceed(new object[] { "one", "two", "three" });
- mocks.Replay(mockInvocation);
-
// new return value should be returned
object newReturnValue = advice.Invoke(mockInvocation);
Assert.AreEqual(expectedReturnValue, newReturnValue);
@@ -305,57 +244,42 @@ public void CacheOnlyItemsOfMethodThatReturnsCollectionWithinTwoDifferentCaches(
Assert.AreEqual("two", itemCache.Get("two"));
Assert.AreEqual("two", itemCache.Get("TWO"));
Assert.AreNotSame(returnValue, newReturnValue);
-
- mocks.VerifyAll();
}
[Test]
public void CacheOnlyItemsOfMethodThatReturnsCollectionOnCondition()
{
MethodInfo method = new EnumerableResultMethod(cacheResultTarget.CacheResultItemsWithCondition).Method;
- object expectedReturnValue = new object[] { "one", "two", "three" };
-
- using (mocks.Record())
- {
- ExpectAttributeRetrieval(method);
- ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
- ExpectCallToProceed(new object[] { "one", "two", "three" });
- ExpectCacheInstanceRetrieval("items", itemCache);
- }
+ object expectedReturnValue = new object[] {"one", "two", "three"};
- using (mocks.Playback())
- {
- // return value should be added to result cache and each item to item cache
- object returnValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, returnValue);
- Assert.AreEqual(2, itemCache.Count);
- Assert.AreEqual("two", itemCache.Get("two"));
- Assert.AreEqual("three", itemCache.Get("three"));
- }
+ ExpectAttributeRetrieval(method);
+ ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
+ ExpectCallToProceed(new object[] {"one", "two", "three"});
+ ExpectCacheInstanceRetrieval("items", itemCache);
+ // return value should be added to result cache and each item to item cache
+ object returnValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, returnValue);
+ Assert.AreEqual(2, itemCache.Count);
+ Assert.AreEqual("two", itemCache.Get("two"));
+ Assert.AreEqual("three", itemCache.Get("three"));
}
[Test]
public void CacheResultOfMethodThatReturnsCollectionOnCondition()
{
MethodInfo method = new EnumerableResultMethod(cacheResultTarget.CacheResultWithCondition).Method;
- object expectedReturnValue = new object[] { };
+ object expectedReturnValue = new object[] {};
- using (mocks.Record())
- {
- ExpectAttributeRetrieval(method);
- ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
- ExpectCacheInstanceRetrieval("results", resultCache);
- ExpectCallToProceed(new object[] { });
- }
+ ExpectAttributeRetrieval(method);
+ ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
+ ExpectCacheInstanceRetrieval("results", resultCache);
+ ExpectCallToProceed(new object[] {});
- using (mocks.Playback())
- {
- // return value should not be added to cache
- object returnValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, returnValue);
- Assert.AreEqual(0, resultCache.Count);
- }
+ // return value should not be added to cache
+ object returnValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, returnValue);
+ Assert.AreEqual(0, resultCache.Count);
}
[Test]
@@ -365,16 +289,12 @@ public void AcceptsEnumerableOnlyReturn()
object[] args = new object[] { "one", "two", "three" };
EnumerableOnlyResult expectedReturnValue = new EnumerableOnlyResult(args);
- mocks.Record();
-
ExpectAttributeRetrieval(method);
ExpectCacheKeyGeneration(method, 5, expectedReturnValue.InnerArray);
ExpectCacheInstanceRetrieval("results", resultCache);
ExpectCallToProceed(expectedReturnValue);
ExpectCacheInstanceRetrieval("items", itemCache);
- mocks.ReplayAll();
-
// return value should be added to result cache and each item to item cache
object returnValue = advice.Invoke(mockInvocation);
Assert.AreEqual(1, resultCache.Count);
@@ -382,16 +302,10 @@ public void AcceptsEnumerableOnlyReturn()
Assert.AreSame(expectedReturnValue, returnValue);
Assert.AreSame(expectedReturnValue, resultCache.Get(5));
- mocks.Verify(mockInvocation);
-
- mocks.BackToRecord(mockInvocation);
-
// and again, but without Proceed() and item cache access...
ExpectAttributeRetrieval(method);
ExpectCacheKeyGeneration(method, 5, IGNORED_ARGS);
- mocks.Replay(mockInvocation);
-
// cached value should be returned, cache remains unchanged
object cachedValue = advice.Invoke(mockInvocation);
Assert.AreSame(expectedReturnValue, cachedValue);
@@ -399,42 +313,30 @@ public void AcceptsEnumerableOnlyReturn()
Assert.AreSame(expectedReturnValue, resultCache.Get(5));
Assert.AreEqual(1, resultCache.Count);
Assert.AreEqual(3, itemCache.Count);
-
- mocks.VerifyAll();
}
-
+
[Test]
public void CacheResultOfMethodThatReturnsCollectionContainingNullItems()
{
MethodInfo method = new EnumerableResultMethod(cacheResultTarget.ReturnsEnumerableOnlyAndItems).Method;
object expectedReturnValue = new object[] { null, "two", null };
- mocks.Record();
-
ExpectAttributeRetrieval(method);
ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
ExpectCacheInstanceRetrieval("results", resultCache);
ExpectCallToProceed(expectedReturnValue);
ExpectCacheInstanceRetrieval("items", itemCache);
- mocks.ReplayAll();
-
// return value should be added to result cache and each item to item cache
object returnValue = advice.Invoke(mockInvocation);
Assert.AreSame(expectedReturnValue, returnValue);
Assert.AreEqual(1, resultCache.Count);
Assert.AreEqual(2, itemCache.Count); // 2 null items result into 1 cached item
- mocks.Verify(mockInvocation);
-
- mocks.BackToRecord(mockInvocation);
-
// and again, but without Proceed() and item cache access...
ExpectAttributeRetrieval(method);
ExpectCacheKeyGeneration(method, 5, IGNORED_ARGS);
- mocks.Replay(mockInvocation);
-
// cached value should be returned
object cachedValue = advice.Invoke(mockInvocation);
Assert.AreSame(expectedReturnValue, cachedValue);
@@ -442,95 +344,74 @@ public void CacheResultOfMethodThatReturnsCollectionContainingNullItems()
Assert.AreSame(expectedReturnValue, resultCache.Get(5));
Assert.AreEqual(1, resultCache.Count);
Assert.AreEqual(2, itemCache.Count);
-
- mocks.VerifyAll();
}
[Test]
public void CacheResultWithMethodInfo()
{
MethodInfo method = new EnumerableResultMethod(cacheResultTarget.CacheResultWithMethodInfo).Method;
- object expectedReturnValue = new object[] { "one", "two", "three" };
+ object expectedReturnValue = new object[] {"one", "two", "three"};
- using (mocks.Record())
- {
- ExpectAttributeRetrieval(method);
- ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
- ExpectCacheInstanceRetrieval("results", resultCache);
- ExpectCallToProceed(new object[] { "one", "two", "three" });
- }
+ ExpectAttributeRetrieval(method);
+ ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
+ ExpectCacheInstanceRetrieval("results", resultCache);
+ ExpectCallToProceed(new object[] {"one", "two", "three"});
- using (mocks.Playback())
- {
- // return value should be added to cache
- object returnValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, returnValue);
- Assert.AreEqual(1, resultCache.Count);
- Assert.AreEqual(returnValue, resultCache.Get("CacheResultWithMethodInfo-5"));
- }
+ // return value should be added to cache
+ object returnValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, returnValue);
+ Assert.AreEqual(1, resultCache.Count);
+ Assert.AreEqual(returnValue, resultCache.Get("CacheResultWithMethodInfo-5"));
}
[Test]
public void CacheResultItemsWithMethodInfo()
{
MethodInfo method = new EnumerableResultMethod(cacheResultTarget.CacheResultItemsWithMethodInfo).Method;
- object expectedReturnValue = new object[] { "one", "two", "three" };
-
- using (mocks.Record())
- {
- ExpectAttributeRetrieval(method);
- ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
- ExpectCallToProceed(new object[] { "one", "two", "three" });
- ExpectCacheInstanceRetrieval("items", itemCache);
- }
+ object expectedReturnValue = new object[] {"one", "two", "three"};
- using (mocks.Playback())
- {
- // return value should be added to result cache and each item to item cache
- object returnValue = advice.Invoke(mockInvocation);
- Assert.AreEqual(expectedReturnValue, returnValue);
- Assert.AreEqual(0, resultCache.Count);
- Assert.AreEqual(3, itemCache.Count);
- Assert.AreEqual("two", itemCache.Get("CacheResultItemsWithMethodInfo-two"));
- }
+ ExpectAttributeRetrieval(method);
+ ExpectCacheKeyGeneration(method, 5, expectedReturnValue);
+ ExpectCallToProceed(new object[] {"one", "two", "three"});
+ ExpectCacheInstanceRetrieval("items", itemCache);
+ // return value should be added to result cache and each item to item cache
+ object returnValue = advice.Invoke(mockInvocation);
+ Assert.AreEqual(expectedReturnValue, returnValue);
+ Assert.AreEqual(0, resultCache.Count);
+ Assert.AreEqual(3, itemCache.Count);
+ Assert.AreEqual("two", itemCache.Get("CacheResultItemsWithMethodInfo-two"));
}
-
- #region Helper methods
-
private void ExpectAttributeRetrieval(MethodInfo method)
{
- Expect.Call(mockInvocation.Method).Return(method).Repeat.AtLeastOnce();
+ A.CallTo(() => mockInvocation.Method).Returns(method);
}
private void ExpectCacheKeyGeneration(MethodInfo method, params object[] arguments)
{
- Expect.Call(mockInvocation.Arguments).Return(arguments).Repeat.AtLeastOnce();
+ A.CallTo(() => mockInvocation.Arguments).Returns(arguments);
}
private void ExpectCacheInstanceRetrieval(string cacheName, ICache cache)
{
- Expect.Call(mockContext.GetObject(cacheName)).Return(cache).Repeat.AtLeastOnce();
+ A.CallTo(() => mockContext.GetObject(cacheName)).Returns(cache);
}
private void ExpectCacheInstanceRetrieval(string cacheName, ICache cache, int repeatTimes)
{
- Expect.Call(mockContext.GetObject(cacheName)).Return(cache).Repeat.Times(repeatTimes);
+ A.CallTo(() => mockContext.GetObject(cacheName)).Returns(cache).NumberOfTimes(repeatTimes);
}
private void ExpectCallToProceed(object expectedReturnValue, int repeatTimes)
{
- Expect.Call(mockInvocation.Proceed()).Return(expectedReturnValue).Repeat.Times(repeatTimes);
+ A.CallTo(() => mockInvocation.Proceed()).Returns(expectedReturnValue).NumberOfTimes(repeatTimes);
}
private void ExpectCallToProceed(object expectedReturnValue)
{
- Expect.Call(mockInvocation.Proceed()).Return(expectedReturnValue);
+ A.CallTo(() => mockInvocation.Proceed()).Returns(expectedReturnValue);
}
-
- #endregion
-
}
#region Inner Class : CacheResultTarget
diff --git a/test/Spring/Spring.Aop.Tests/Aspects/Cache/InvalidateCacheAdviceTests.cs b/test/Spring/Spring.Aop.Tests/Aspects/Cache/InvalidateCacheAdviceTests.cs
index 1519157c9..98b26327d 100644
--- a/test/Spring/Spring.Aop.Tests/Aspects/Cache/InvalidateCacheAdviceTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aspects/Cache/InvalidateCacheAdviceTests.cs
@@ -18,18 +18,15 @@
#endregion
-#region Imports
-
using System.Reflection;
-using NUnit.Framework;
-using Rhino.Mocks;
+using FakeItEasy;
+
+using NUnit.Framework;
using Spring.Caching;
using Spring.Context;
-#endregion
-
namespace Spring.Aspects.Cache
{
///
@@ -42,13 +39,11 @@ public sealed class InvalidateCacheAdviceTests
private IApplicationContext mockContext;
private InvalidateCacheAdvice advice;
private ICache cache;
- private MockRepository mocks;
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
- mockContext = (IApplicationContext) mocks.CreateMock(typeof (IApplicationContext));
+ mockContext = A.Fake();
advice = new InvalidateCacheAdvice();
advice.ApplicationContext = mockContext;
@@ -66,7 +61,6 @@ public void TestSingleKeyInvalidation()
object[] args = new object[] { 2 };
ExpectCacheInstanceRetrieval("cache", cache);
- mocks.ReplayAll();
Assert.AreEqual(3, cache.Count);
@@ -74,8 +68,6 @@ public void TestSingleKeyInvalidation()
advice.AfterReturning(null, method, args, null);
Assert.AreEqual(2, cache.Count);
Assert.IsNull(cache.Get(2));
-
- mocks.VerifyAll();
}
[Test]
@@ -85,7 +77,6 @@ public void TestMultiKeyInvalidation()
object[] args = new object[] { 2 };
ExpectCacheInstanceRetrieval("cache", cache);
- mocks.ReplayAll();
Assert.AreEqual(3, cache.Count);
@@ -93,8 +84,6 @@ public void TestMultiKeyInvalidation()
advice.AfterReturning(null, method, args, null);
Assert.AreEqual(1, cache.Count);
Assert.AreEqual("two", cache.Get(2));
-
- mocks.VerifyAll();
}
[Test]
@@ -103,15 +92,12 @@ public void TestWholeCacheInvalidation()
MethodInfo method = typeof(InvalidateCacheTarget).GetMethod("InvalidateAll");
ExpectCacheInstanceRetrieval("cache", cache);
- mocks.ReplayAll();
Assert.AreEqual(3, cache.Count);
// all items should be removed from cache
advice.AfterReturning(null, method, null, null);
Assert.AreEqual(0, cache.Count);
-
- mocks.VerifyAll();
}
[Test]
@@ -122,7 +108,6 @@ public void TestMultipleCachesInvalidation()
ExpectCacheInstanceRetrieval("cache", cache);
ExpectCacheInstanceRetrieval("cache", cache);
- mocks.ReplayAll();
Assert.AreEqual(3, cache.Count);
@@ -130,8 +115,6 @@ public void TestMultipleCachesInvalidation()
// all items except item "two" should be removed from cache
advice.AfterReturning(null, method, args, null);
Assert.AreEqual(0, cache.Count);
-
- mocks.VerifyAll();
}
[Test]
@@ -148,14 +131,10 @@ public void TestConditionInvalidation()
Assert.AreEqual("three", cache.Get(3));
}
- #region Helper methods
-
private void ExpectCacheInstanceRetrieval(string cacheName, ICache cacheToReturn)
{
- Expect.Call(mockContext.GetObject(cacheName)).Return(cacheToReturn);
+ A.CallTo(() => mockContext.GetObject(cacheName)).Returns(cacheToReturn).Once();
}
-
- #endregion
}
#region Inner Class : InvalidateCacheTarget
diff --git a/test/Spring/Spring.Aop.Tests/Aspects/Logging/SimpleLoggingAdviceTests.cs b/test/Spring/Spring.Aop.Tests/Aspects/Logging/SimpleLoggingAdviceTests.cs
index 716e0c7cc..853c71265 100644
--- a/test/Spring/Spring.Aop.Tests/Aspects/Logging/SimpleLoggingAdviceTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aspects/Logging/SimpleLoggingAdviceTests.cs
@@ -18,19 +18,17 @@
#endregion
-#region Imports
-
using System;
using System.Reflection;
using AopAlliance.Intercept;
using Common.Logging;
+
+using FakeItEasy;
+
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Aop.Framework;
-#endregion
-
namespace Spring.Aspects.Logging
{
///
@@ -51,12 +49,9 @@ public void DoSomething()
{ }
}
- private MockRepository mocks;
-
[SetUp]
public void Setup()
{
- mocks = new MockRepository();
}
[Test]
@@ -64,101 +59,76 @@ public void IntegrationTest()
{
ProxyFactory pf = new ProxyFactory(new TestTarget());
- ILog log = (ILog)mocks.CreateMock(typeof(ILog));
+ ILog log = A.Fake();
SimpleLoggingAdvice loggingAdvice = new SimpleLoggingAdvice(log);
pf.AddAdvice(loggingAdvice);
- Expect.Call(log.IsTraceEnabled).Return(true).Repeat.Any();
- log.Trace("Entering DoSomething");
- log.Trace("Exiting DoSomething");
-
- mocks.ReplayAll();
+ A.CallTo(() => log.IsTraceEnabled).Returns(true);
object proxy = pf.GetProxy();
ITestTarget ptt = (ITestTarget)proxy;
ptt.DoSomething();
- mocks.VerifyAll();
+ A.CallTo(() => log.Trace("Entering DoSomething")).MustHaveHappened();
+ A.CallTo(() => log.Trace("Exiting DoSomething")).MustHaveHappened();
}
[Test]
public void SunnyDayLoggingCorrectly()
{
- ILog log = (ILog)mocks.CreateMock(typeof(ILog));
- IMethodInvocation methodInvocation = (IMethodInvocation)mocks.CreateMock(typeof(IMethodInvocation));
+ ILog log = A.Fake();
+ IMethodInvocation methodInvocation = A.Fake();
MethodInfo mi = typeof(string).GetMethod("ToString", Type.EmptyTypes);
//two additional calls the method are to retrieve the method name on entry/exit...
- Expect.Call(methodInvocation.Method).Return(mi).Repeat.Any();
-
- Expect.Call(log.IsTraceEnabled).Return(true).Repeat.Any();
- log.Trace("Entering ToString");
-
- Expect.Call(methodInvocation.Proceed()).Return(null);
-
- log.Trace("Exiting ToString");
-
- mocks.ReplayAll();
+ A.CallTo(() => methodInvocation.Method).Returns(mi);
+ A.CallTo(() => log.IsTraceEnabled).Returns(true);
+ A.CallTo(() => methodInvocation.Proceed()).Returns(null);
TestableSimpleLoggingAdvice loggingAdvice = new TestableSimpleLoggingAdvice(true);
loggingAdvice.CallInvokeUnderLog(methodInvocation, log);
- mocks.VerifyAll();
-
+ A.CallTo(() => log.Trace("Entering ToString")).MustHaveHappened();
+ A.CallTo(() => log.Trace("Exiting ToString")).MustHaveHappened();
}
[Test]
public void SunnyDayLoggingCorrectlyDebugLevel()
{
- ILog log = (ILog)mocks.CreateMock(typeof(ILog));
- IMethodInvocation methodInvocation = (IMethodInvocation)mocks.CreateMock(typeof(IMethodInvocation));
+ ILog log = A.Fake();
+ IMethodInvocation methodInvocation = A.Fake();
MethodInfo mi = typeof(string).GetMethod("ToString", Type.EmptyTypes);
//two additional calls the method are to retrieve the method name on entry/exit...
- Expect.Call(methodInvocation.Method).Return(mi).Repeat.Any();
-
- Expect.Call(log.IsTraceEnabled).Return(false).Repeat.Any();
- Expect.Call(log.IsDebugEnabled).Return(true).Repeat.Any();
- log.Debug("Entering ToString");
-
- Expect.Call(methodInvocation.Proceed()).Return(null);
+ A.CallTo(() => methodInvocation.Method).Returns(mi);
- log.Debug("Exiting ToString");
+ A.CallTo(() => log.IsTraceEnabled).Returns(false);
+ A.CallTo(() => log.IsDebugEnabled).Returns(true);
- mocks.ReplayAll();
+ A.CallTo(() => methodInvocation.Proceed()).Returns(null);
TestableSimpleLoggingAdvice loggingAdvice = new TestableSimpleLoggingAdvice(true);
loggingAdvice.LogLevel = LogLevel.Debug;
Assert.IsTrue(loggingAdvice.CallIsInterceptorEnabled(methodInvocation, log));
loggingAdvice.CallInvokeUnderLog(methodInvocation, log);
- mocks.VerifyAll();
-
+ A.CallTo(() => log.Debug("Entering ToString")).MustHaveHappened();
+ A.CallTo(() => log.Debug("Exiting ToString")).MustHaveHappened();
}
-
[Test]
public void ExceptionPathStillLogsCorrectly()
{
- ILog log = (ILog)mocks.CreateMock(typeof(ILog));
- IMethodInvocation methodInvocation = (IMethodInvocation)mocks.CreateMock(typeof(IMethodInvocation));
+ ILog log = A.Fake();
+ IMethodInvocation methodInvocation = A.Fake();
MethodInfo mi = typeof(string).GetMethod("ToString", Type.EmptyTypes);
//two additional calls the method are to retrieve the method name on entry/exit...
- Expect.Call(methodInvocation.Method).Return(mi).Repeat.Any();
-
- Expect.Call(log.IsTraceEnabled).Return(true).Repeat.Any();
- log.Trace("Entering...");
-
- LastCall.On(log).IgnoreArguments();
+ A.CallTo(() => methodInvocation.Method).Returns(mi);
+ A.CallTo(() => log.IsTraceEnabled).Returns(true);
Exception e = new ArgumentException("bad value");
- Expect.Call(methodInvocation.Proceed()).Throw(e);
-
- log.Trace("Exception...", e);
- LastCall.On(log).IgnoreArguments();
-
- mocks.ReplayAll();
+ A.CallTo(() => methodInvocation.Proceed()).Throws(e);
TestableSimpleLoggingAdvice loggingAdvice = new TestableSimpleLoggingAdvice(true);
try
@@ -168,39 +138,27 @@ public void ExceptionPathStillLogsCorrectly()
}
catch (ArgumentException)
{
-
}
- mocks.VerifyAll();
-
+ A.CallTo(() => log.Trace("Entering ToString")).MustHaveHappened();
+ A.CallTo(() => log.Trace("Exception thrown in ToString, ToString", e)).MustHaveHappened();
}
-
[Test]
public void SunnyDayLoggingAllOptionalInformationCorrectly()
{
- ILog log = (ILog)mocks.CreateMock(typeof(ILog));
- IMethodInvocation methodInvocation = (IMethodInvocation)mocks.CreateMock(typeof(IMethodInvocation));
+ ILog log = A.Fake();
+ IMethodInvocation methodInvocation = A.Fake();
MethodInfo mi = typeof(Dog).GetMethod("Bark");
//two additional calls the method are to retrieve the method name on entry/exit...
- Expect.Call(methodInvocation.Method).Return(mi).Repeat.Any();
+ A.CallTo(() => methodInvocation.Method).Returns(mi);
int[] luckyNumbers = new int[] { 1, 2, 3 };
object[] args = new object[] { "hello", luckyNumbers };
-
- Expect.Call(methodInvocation.Arguments).Return(args);
-
- Expect.Call(log.IsTraceEnabled).Return(true).Repeat.Any();
- log.Trace("Entering...");
- LastCall.IgnoreArguments();
-
- Expect.Call(methodInvocation.Proceed()).Return(4);
-
- log.Trace("Exiting...");
- LastCall.IgnoreArguments();
-
- mocks.ReplayAll();
+ A.CallTo(() => methodInvocation.Arguments).Returns(args);
+ A.CallTo(() => log.IsTraceEnabled).Returns(true);
+ A.CallTo(() => methodInvocation.Proceed()).Returns(4);
TestableSimpleLoggingAdvice loggingAdvice = new TestableSimpleLoggingAdvice(true);
loggingAdvice.LogExecutionTime = true;
@@ -209,7 +167,8 @@ public void SunnyDayLoggingAllOptionalInformationCorrectly()
loggingAdvice.CallInvokeUnderLog(methodInvocation, log);
- mocks.VerifyAll();
+ A.CallTo(() => log.Trace(A.That.StartsWith("Entering Bark"))).MustHaveHappened();
+ A.CallTo(() => log.Trace(A.That.StartsWith("Exiting Bark"))).MustHaveHappened();
}
}
diff --git a/test/Spring/Spring.Aop.Tests/Aspects/Validation/ParameterValidationAdviceTests.cs b/test/Spring/Spring.Aop.Tests/Aspects/Validation/ParameterValidationAdviceTests.cs
index 638fc40c8..94a025c9a 100644
--- a/test/Spring/Spring.Aop.Tests/Aspects/Validation/ParameterValidationAdviceTests.cs
+++ b/test/Spring/Spring.Aop.Tests/Aspects/Validation/ParameterValidationAdviceTests.cs
@@ -18,18 +18,16 @@
#endregion
-#region Imports
-
using System;
using System.Reflection;
-using Rhino.Mocks;
+
+using FakeItEasy;
+
using NUnit.Framework;
using Spring.Context;
using Spring.Validation;
using Spring.Validation.Actions;
-#endregion
-
namespace Spring.Aspects.Validation
{
///
@@ -42,13 +40,11 @@ public sealed class ParameterValidationAdviceTests
private IApplicationContext mockContext;
private ParameterValidationAdvice advice;
private RequiredValidator requiredValidator;
- private MockRepository mocks;
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
- mockContext = mocks.CreateMock();
+ mockContext = A.Fake();
advice = new ParameterValidationAdvice();
advice.ApplicationContext = mockContext;
@@ -65,18 +61,11 @@ public void TestValidArgument()
ValidationTarget target = new ValidationTarget();
object[] args = new object[] {inventor};
- using (mocks.Record())
- {
- ExpectValidatorRetrieval("required", requiredValidator);
- }
-
- using (mocks.Playback())
- {
- advice.Before(method, args, target);
- method.Invoke(target, args);
- Assert.AreEqual("NIKOLA TESLA", inventor.Name);
- }
+ ExpectValidatorRetrieval("required", requiredValidator);
+ advice.Before(method, args, target);
+ method.Invoke(target, args);
+ Assert.AreEqual("NIKOLA TESLA", inventor.Name);
}
[Test]
@@ -84,25 +73,15 @@ public void TestInvalidArgument()
{
MethodInfo method = typeof(ValidationTarget).GetMethod("Save");
- using (mocks.Record())
- {
- ExpectValidatorRetrieval("required", requiredValidator);
- }
+ ExpectValidatorRetrieval("required", requiredValidator);
- using (mocks.Playback())
- {
- Assert.Throws(() => advice.Before(method, new object[] { null }, new ValidationTarget()));
- }
+ Assert.Throws(() => advice.Before(method, new object[] {null}, new ValidationTarget()));
}
- #region Helper methods
-
private void ExpectValidatorRetrieval(string validatorName, IValidator validator)
{
- Expect.Call(mockContext.GetObject(validatorName)).Return(validator);
+ A.CallTo(() => mockContext.GetObject(validatorName)).Returns(validator).Once();
}
-
- #endregion
}
#region Inner Class : ValidationTarget
diff --git a/test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.2010.csproj b/test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.2010.csproj
index 2dd4c4a7a..18f5893fa 100644
--- a/test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.2010.csproj
+++ b/test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.2010.csproj
@@ -7,10 +7,11 @@
+
+
-
diff --git a/test/Spring/Spring.Core.Tests/Caching/AbstractCacheTests.cs b/test/Spring/Spring.Core.Tests/Caching/AbstractCacheTests.cs
index 342567a97..1c0cd4b77 100644
--- a/test/Spring/Spring.Core.Tests/Caching/AbstractCacheTests.cs
+++ b/test/Spring/Spring.Core.Tests/Caching/AbstractCacheTests.cs
@@ -18,19 +18,17 @@
#endregion
-#region Imports
-
using System;
using System.Threading;
-using NUnit.Framework;
-using Rhino.Mocks;
-#endregion
+using FakeItEasy;
+
+using NUnit.Framework;
namespace Spring.Caching
{
///
- /// Tests behaviour to ensure,
+ /// Tests behaviour to ensure,
/// that derived classes maybe rely on this default behaviour
///
/// Erich Eichinger
@@ -56,15 +54,13 @@ protected override void DoInsert(object key, object value, TimeSpan timeToLive)
TimeSpan expectedPerItemTTL;
TimeSpan expectedPerCacheTTL;
- MockRepository mocks;
ExposingAbstractCache cache;
- string[] KEYS = new string[] { "keyA", "keyB" };
+ string[] KEYS = new string[] {"keyA", "keyB"};
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
- cache = (ExposingAbstractCache)mocks.PartialMock(typeof(ExposingAbstractCache));
+ cache = A.Fake(options => options.CallsBaseMethods());
expectedPerItemTTL = new TimeSpan(0, 0, 10);
expectedPerCacheTTL = new TimeSpan(0, 0, 20);
@@ -75,7 +71,7 @@ public void SetUp()
[Test]
public void TestDefaults()
{
- ExposingAbstractCache localCache = (ExposingAbstractCache)mocks.PartialMock(typeof(ExposingAbstractCache));
+ ExposingAbstractCache localCache = A.Fake();
Assert.AreEqual(TimeSpan.Zero, localCache.TimeToLive);
Assert.AreEqual(false, localCache.EnforceTimeToLive);
}
@@ -85,96 +81,78 @@ public void AppliesPerCacheDefaultsIfNoPerItemValuesGiven()
{
// set expectations
cache.DoInsertExposed("key", "value", expectedPerCacheTTL);
- mocks.ReplayAll();
- // verify
cache.Insert("key", "value", expectedPerCacheTTL);
- mocks.VerifyAll();
+ A.CallTo(() => cache.DoInsertExposed("key", "value", expectedPerCacheTTL)).MustHaveHappened();
}
[Test]
public void AppliesPerCacheDefaultsIfTTLLessThanZero()
{
- // set expectations
- cache.DoInsertExposed("key", "value", expectedPerCacheTTL);
- cache.DoInsertExposed("key", "value", expectedPerCacheTTL);
- cache.DoInsertExposed("key", "value", expectedPerCacheTTL);
- cache.DoInsertExposed("key", "value", expectedPerCacheTTL);
- mocks.ReplayAll();
- // verify
cache.Insert("key", "value", new TimeSpan(Timeout.Infinite));
+ A.CallTo(() => cache.DoInsertExposed("key", "value", expectedPerCacheTTL)).MustHaveHappened();
+
cache.Insert("key", "value", new TimeSpan(-1));
- cache.Insert("key", "value", new TimeSpan(Int64.MinValue));
+ A.CallTo(() => cache.DoInsertExposed("key", "value", expectedPerCacheTTL)).MustHaveHappened();
+
+ cache.Insert("key", "value", new TimeSpan(long.MinValue));
+ A.CallTo(() => cache.DoInsertExposed("key", "value", expectedPerCacheTTL)).MustHaveHappened();
+
cache.Insert("key", "value", TimeSpan.MinValue);
- mocks.VerifyAll();
+ A.CallTo(() => cache.DoInsertExposed("key", "value", expectedPerCacheTTL)).MustHaveHappened();
}
[Test]
public void AppliesPerCacheDefaultsIfEnfored()
{
- // set expectations
- cache.DoInsertExposed("key", "value", expectedPerCacheTTL);
- mocks.ReplayAll();
- // verify
cache.EnforceTimeToLive = true;
cache.Insert("key", "value", expectedPerItemTTL);
- mocks.VerifyAll();
+
+ A.CallTo(() => cache.DoInsertExposed("key", "value", expectedPerCacheTTL)).MustHaveHappened();
}
[Test]
public void AppliesZeroTTLIfTTLIsZero()
{
- // set expectations
- cache.DoInsertExposed("key", "value", TimeSpan.Zero);
- mocks.ReplayAll();
- // verify
cache.Insert("key", "value", TimeSpan.Zero);
- mocks.VerifyAll();
+
+ A.CallTo(() => cache.DoInsertExposed("key", "value", TimeSpan.Zero)).MustHaveHappened();
}
[Test]
public void AppliesPerItemTTLIfTTLGreaterZero()
{
- // set expectations
- cache.DoInsertExposed("key", "value", expectedPerItemTTL);
- mocks.ReplayAll();
- // verify
cache.Insert("key", "value", expectedPerItemTTL);
- mocks.VerifyAll();
+
+ A.CallTo(() => cache.DoInsertExposed("key", "value", expectedPerItemTTL)).MustHaveHappened();
}
[Test]
public void RemoveAllCausesCallsToRemove()
{
- // set expectations
- cache.Remove(KEYS[0]);
- cache.Remove(KEYS[1]);
- mocks.ReplayAll();
- // verify
cache.RemoveAll(KEYS);
- mocks.VerifyAll();
+
+ A.CallTo(() => cache.Remove(KEYS[0])).MustHaveHappened();
+ A.CallTo(() => cache.Remove(KEYS[1])).MustHaveHappened();
}
[Test]
public void ClearCausesCallToRemoveAllUsingKeys()
{
- // set expectations
- Expect.Call(cache.Keys).Return(KEYS);
- cache.RemoveAll(KEYS);
- mocks.ReplayAll();
- // verify
+ A.CallTo(() => cache.Keys).Returns(this.KEYS);
+
cache.Clear();
- mocks.VerifyAll();
+
+ A.CallTo(() => cache.Keys).MustHaveHappened();
+ A.CallTo(() => cache.RemoveAll(KEYS)).MustHaveHappened();
}
[Test]
public void CountUsingKeys()
{
// set expectations
- Expect.Call(cache.Keys).Return(this.KEYS);
- mocks.ReplayAll();
- // verify
- Assert.AreEqual( this.KEYS.Length, cache.Count );
- mocks.VerifyAll();
+ A.CallTo(() => cache.Keys).Returns(this.KEYS);
+
+ Assert.AreEqual(this.KEYS.Length, cache.Count);
}
}
}
\ No newline at end of file
diff --git a/test/Spring/Spring.Core.Tests/Collections/PriorityQueueTests.cs b/test/Spring/Spring.Core.Tests/Collections/PriorityQueueTests.cs
index ec98005a4..89f9b2257 100644
--- a/test/Spring/Spring.Core.Tests/Collections/PriorityQueueTests.cs
+++ b/test/Spring/Spring.Core.Tests/Collections/PriorityQueueTests.cs
@@ -70,7 +70,7 @@ public void ThrowsArgumentExceptionForZeroCapacity()
[Test]
public void ThrowsArgumentNullExceptionForNullCollection()
{
- Assert.Throws(() => new PriorityQueue((ICollection) null));
+ Assert.Throws(() => new PriorityQueue(null));
}
[Test]
diff --git a/test/Spring/Spring.Core.Tests/Context/Support/AbstractApplicationContextTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/AbstractApplicationContextTests.cs
index decbc1a37..e502ed7a4 100644
--- a/test/Spring/Spring.Core.Tests/Context/Support/AbstractApplicationContextTests.cs
+++ b/test/Spring/Spring.Core.Tests/Context/Support/AbstractApplicationContextTests.cs
@@ -18,11 +18,11 @@
#endregion
-#region Imports
-
using System;
+
+using FakeItEasy;
+
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Core;
using Spring.Core.IO;
using Spring.Objects;
@@ -32,8 +32,6 @@
using Spring.Objects.Factory.Support;
using Spring.Objects.Factory.Xml;
-#endregion
-
namespace Spring.Context.Support
{
[TestFixture]
@@ -60,7 +58,7 @@ public void Destroy()
public void ContextAwareDisplayName()
{
-
+
}
[Test]
@@ -96,8 +94,7 @@ public void ExecutesAllContextEventHandlersAndRethrowsExceptionsThrownDuringCont
[Test]
public void DoesNotSearchParentContextForMessageSource()
{
- MockRepository mocks = new MockRepository();
- IMessageSource msgSource = (IMessageSource) mocks.DynamicMock(typeof (IMessageSource));
+ IMessageSource msgSource = A.Fake();
MockApplicationContext parentCtx = new MockApplicationContext("parentContext");
parentCtx.ObjectFactory.RegisterSingleton(AbstractApplicationContext.MessageSourceObjectName, msgSource);
MockApplicationContext childContext = new MockApplicationContext("childContext", parentCtx);
@@ -112,8 +109,7 @@ public void DoesNotSearchParentContextForMessageSource()
[Test]
public void DoesNotSearchParentContextForEventRegistry()
{
- MockRepository mocks = new MockRepository();
- IEventRegistry eventRegistry = (IEventRegistry)mocks.DynamicMock(typeof(IEventRegistry));
+ IEventRegistry eventRegistry = A.Fake();
MockApplicationContext parentCtx = new MockApplicationContext("parentContext");
parentCtx.ObjectFactory.RegisterSingleton(AbstractApplicationContext.EventRegistryObjectName, eventRegistry);
MockApplicationContext childContext = new MockApplicationContext("childContext", parentCtx);
@@ -398,7 +394,7 @@ public void ThrowsCannotLoadObjectTypeExceptionOnInvalidTypename()
-"));
+"));
myContext.Refresh();
}
catch (Exception e)
diff --git a/test/Spring/Spring.Core.Tests/Context/Support/AbstractMessageSourceTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/AbstractMessageSourceTests.cs
index 616a3061d..ef3998c1e 100644
--- a/test/Spring/Spring.Core.Tests/Context/Support/AbstractMessageSourceTests.cs
+++ b/test/Spring/Spring.Core.Tests/Context/Support/AbstractMessageSourceTests.cs
@@ -18,36 +18,30 @@
#endregion
-#region Imports
-
using System.Globalization;
-using NUnit.Framework;
-using Rhino.Mocks;
-#endregion
+using FakeItEasy;
+
+using NUnit.Framework;
namespace Spring.Context.Support
{
[TestFixture]
public sealed class AbstractMessageSourceTests : AbstractMessageSource
{
- private MockRepository mocks;
[SetUp]
public void Init()
{
- mocks = new MockRepository();
- resetMe();
+ ResetMe();
}
[Test]
public void GetResolvableNullCodes()
- {
- IMessageSourceResolvable res = mocks.StrictMock();
- Expect.Call(res.GetCodes()).Return(null);
- Expect.Call(res.DefaultMessage).Return(null);
- mocks.ReplayAll();
+ {
+ var res = A.Fake();
+ A.CallTo(() => res.DefaultMessage).Returns(null);
+
Assert.Throws(() => GetMessage(res, CultureInfo.CurrentCulture));
- mocks.VerifyAll();
}
[Test]
@@ -56,92 +50,79 @@ public void GetResolvableDefaultsToParentMessageSource()
string MSGCODE = "nullCode";
object[] MSGARGS = new object[] { "arg1", "arg2" };
- IMessageSourceResolvable res = mocks.StrictMock();
- Expect.Call(res.GetArguments()).Return(MSGARGS);
- Expect.Call(res.GetCodes()).Return(new string[] {MSGCODE}).Repeat.Once();
-
- IMessageSource parentSource = mocks.StrictMock();
- Expect.Call(parentSource.GetMessage(MSGCODE, null, CultureInfo.CurrentCulture, MSGARGS)).Return(
- "MockMessageSource");
+ IMessageSourceResolvable res = A.Fake();
+ A.CallTo(() => res.GetArguments()).Returns(MSGARGS);
+ A.CallTo(() => res.GetCodes()).Returns(new string[] {MSGCODE}).Once();
+
+ IMessageSource parentSource = A.Fake();
+ A.CallTo(() => parentSource.GetMessage(MSGCODE, null, CultureInfo.CurrentCulture, A._)).Returns("MockMessageSource");
ParentMessageSource = parentSource;
- mocks.ReplayAll();
Assert.AreEqual("MockMessageSource", GetMessage(res, CultureInfo.CurrentCulture), "My Message");
- mocks.VerifyAll();
}
[Test]
public void GetMessageParentMessageSource()
{
object[] args = new object[] {"arguments"};
- IMessageSource parentSource = mocks.StrictMock();
- Expect.Call(parentSource.GetMessage("null", null, CultureInfo.CurrentCulture, args)).Return(
- "my parent message");
+ IMessageSource parentSource = A.Fake();
+ A.CallTo(() => parentSource.GetMessage("null", null, CultureInfo.CurrentCulture, A._)).Returns("my parent message");
ParentMessageSource = parentSource;
- mocks.ReplayAll();
Assert.AreEqual("my parent message", GetMessage("null", "message", CultureInfo.CurrentCulture, args[0]));
- mocks.VerifyAll();
}
[Test]
public void GetMessageResolvableDefaultMessage()
{
- IMessageSourceResolvable res = mocks.StrictMock();
- Expect.Call(res.DefaultMessage).Return("MyDefaultMessage").Repeat.AtLeastOnce();
- Expect.Call(res.GetCodes()).Return(null);
- Expect.Call(res.GetArguments()).Return(null);
- mocks.ReplayAll();
-
+ IMessageSourceResolvable res = A.Fake();
+ A.CallTo(() => res.DefaultMessage).Returns("MyDefaultMessage");
+ A.CallTo(() => res.GetCodes()).Returns(null);
+ A.CallTo(() => res.GetArguments()).Returns(null);
+
Assert.AreEqual("MyDefaultMessage", GetMessage(res, CultureInfo.CurrentCulture), "Default");
-
- mocks.VerifyAll();
}
[Test]
public void GetMessageResolvableReturnsFirstCode()
{
+ IMessageSourceResolvable res = A.Fake();
+ A.CallTo(() => res.DefaultMessage).Returns(null);
+ A.CallTo(() => res.GetCodes()).Returns(new string[] {"null"});
+ A.CallTo(() => res.GetArguments()).Returns(null);
- IMessageSourceResolvable res = mocks.StrictMock();
- Expect.Call(res.DefaultMessage).Return(null).Repeat.AtLeastOnce();
- Expect.Call(res.GetCodes()).Return(new string[] {"null"});
- Expect.Call(res.GetArguments()).Return(null).Repeat.AtLeastOnce();
- mocks.ReplayAll();
UseCodeAsDefaultMessage = true;
- Assert.AreEqual("null", GetMessage(res, CultureInfo.CurrentCulture), "Code");
- mocks.VerifyAll();
+ Assert.AreEqual("null", GetMessage(res, CultureInfo.CurrentCulture), "Code");
}
[Test]
public void GetMessageResolvableNoValidMessage()
{
- IMessageSourceResolvable res = mocks.StrictMock();
- Expect.Call(res.DefaultMessage).Return(null).Repeat.AtLeastOnce();
- Expect.Call(res.GetCodes()).Return(null);
- Expect.Call(res.GetArguments()).Return(null).Repeat.AtLeastOnce();
- mocks.ReplayAll();
+ IMessageSourceResolvable res = A.Fake();
+ A.CallTo(() => res.DefaultMessage).Returns(null);
+ A.CallTo(() => res.GetCodes()).Returns(null);
+ A.CallTo(() => res.GetArguments()).Returns(null);
+
Assert.Throws(() => GetMessage(res, CultureInfo.CurrentCulture));
}
[Test]
public void GetMessageResolvableValidMessageAndCode()
{
- IMessageSourceResolvable res = mocks.StrictMock();
- Expect.Call(res.GetCodes()).Return(new string[] {"code1"});
- Expect.Call(res.GetArguments()).Return(new object[] { "my", "arguments" }).Repeat.AtLeastOnce();
- mocks.ReplayAll();
+ IMessageSourceResolvable res = A.Fake();
+ A.CallTo(() => res.GetCodes()).Returns(new string[] {"code1"});
+ A.CallTo(() => res.GetArguments()).Returns(new object[] { "my", "arguments" });
+
Assert.AreEqual("my arguments", GetMessage(res, CultureInfo.CurrentCulture), "Resolve");
- mocks.VerifyAll();
}
[Test]
public void GetMessageResolvableValidMessageAndCodeNullCulture()
{
- IMessageSourceResolvable res = mocks.StrictMock();
- Expect.Call(res.GetCodes()).Return(new string[] { "code1" });
- Expect.Call(res.GetArguments()).Return(new object[] { "my", "arguments" }).Repeat.AtLeastOnce();
- mocks.ReplayAll();
- Assert.AreEqual("my arguments", GetMessage(res, null), "Resolve");
- mocks.VerifyAll();
+ IMessageSourceResolvable res = A.Fake();
+ A.CallTo(() => res.GetCodes()).Returns(new string[] { "code1" });
+ A.CallTo(() => res.GetArguments()).Returns(new object[] { "my", "arguments" });
+
+ Assert.AreEqual("my arguments", GetMessage(res, null), "Resolve");
}
[Test]
@@ -179,28 +160,25 @@ public void GetMessageNoValidMessage()
[Test]
public void GetMessageWithResolvableArguments()
{
- IMessageSourceResolvable res = mocks.StrictMock();
- Expect.Call(res.GetCodes()).Return(new string[] { "code1" });
- Expect.Call(res.GetArguments()).Return(new object[] { "my", "resolvable" }).Repeat.AtLeastOnce();
- mocks.ReplayAll();
+ IMessageSourceResolvable res = A.Fake();
+ A.CallTo(() => res.GetCodes()).Returns(new string[] { "code1" });
+ A.CallTo(() => res.GetArguments()).Returns(new object[] { "my", "resolvable" });
+
Assert.AreEqual("spring my resolvable", GetMessage("code2", CultureInfo.CurrentCulture, new object[] {"spring", res}), "Resolve");
- mocks.VerifyAll();
}
[Test]
public void GetMessageResolvableValidMessageAndCodNullMessageFormat()
{
- IMessageSourceResolvable res = mocks.StrictMock();
- Expect.Call(res.DefaultMessage).Return("myDefaultMessage").Repeat.AtLeastOnce();
- Expect.Call(res.GetCodes()).Return(new string[] { "nullCode" });
- Expect.Call(res.GetArguments()).Return(null).Repeat.AtLeastOnce();
- mocks.ReplayAll();
+ IMessageSourceResolvable res = A.Fake();
+ A.CallTo(() => res.DefaultMessage).Returns("myDefaultMessage");
+ A.CallTo(() => res.GetCodes()).Returns(new string[] { "nullCode" });
+ A.CallTo(() => res.GetArguments()).Returns(null);
Assert.AreEqual("myDefaultMessage", GetMessage(res, null), "Resolve");
- mocks.VerifyAll();
}
- private void resetMe()
+ private void ResetMe()
{
ParentMessageSource = null;
UseCodeAsDefaultMessage = false;
@@ -215,7 +193,7 @@ protected override string ResolveMessage(string code, CultureInfo cultureInfo)
else if (code.Equals("nullCode"))
{
return null;
- }
+ }
else
{
return "{0} {1}";
diff --git a/test/Spring/Spring.Core.Tests/Context/Support/DefaultMessageSourceResolvableTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/DefaultMessageSourceResolvableTests.cs
index 2f5237d1b..5c7c19853 100644
--- a/test/Spring/Spring.Core.Tests/Context/Support/DefaultMessageSourceResolvableTests.cs
+++ b/test/Spring/Spring.Core.Tests/Context/Support/DefaultMessageSourceResolvableTests.cs
@@ -18,13 +18,11 @@
#endregion
-#region Imports
-
using System.Text;
-using NUnit.Framework;
-using Rhino.Mocks;
-#endregion
+using FakeItEasy;
+
+using NUnit.Framework;
namespace Spring.Context.Support
{
@@ -34,14 +32,11 @@ namespace Spring.Context.Support
[TestFixture]
public sealed class DefaultMessageSourceResolvableTests
{
- private MockRepository mocks;
[SetUp]
public void Init()
{
- mocks = new MockRepository();
}
-
[Test]
public void InstantiationWithASingleCodeDefaultsToEmptyDefaultMessage()
{
@@ -49,7 +44,7 @@ public void InstantiationWithASingleCodeDefaultsToEmptyDefaultMessage()
Assert.AreEqual(string.Empty, dmr.DefaultMessage,
"Not defaulting to non null empty string value (it must).");
}
-
+
[Test]
public void NullLastCode()
{
@@ -86,16 +81,15 @@ public void ResolvableToStringNullArguments()
[Test]
public void DefaultResolvableFromExistingResolvable()
{
- IMessageSourceResolvable res = mocks.StrictMock();
- Expect.Call(res.DefaultMessage).Return("defaultMessageFromMock").Repeat.AtLeastOnce();
- Expect.Call(res.GetCodes()).Return(new string[] { "code1FromMock" });
- Expect.Call(res.GetArguments()).Return(new object[] { "ArgumentFromMock" }).Repeat.AtLeastOnce();
- mocks.ReplayAll();
- DefaultMessageSourceResolvable dmr = new DefaultMessageSourceResolvable(res);
+ IMessageSourceResolvable res = A.Fake();
+ A.CallTo(() => res.DefaultMessage).Returns("defaultMessageFromMock");
+ A.CallTo(() => res.GetCodes()).Returns(new string[] { "code1FromMock" });
+ A.CallTo(() => res.GetArguments()).Returns(new object[] { "ArgumentFromMock" });
+
+ DefaultMessageSourceResolvable dmr = new DefaultMessageSourceResolvable(res);
Assert.AreEqual("defaultMessageFromMock", dmr.DefaultMessage, "default");
Assert.AreEqual("code1FromMock", dmr.LastCode, "codes");
Assert.AreEqual("ArgumentFromMock", (dmr.GetArguments())[0], "arguments");
- mocks.VerifyAll();
}
private string getResolvableString()
diff --git a/test/Spring/Spring.Core.Tests/Context/Support/DelegatingMessageSourceTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/DelegatingMessageSourceTests.cs
index f772a8598..9fbd48126 100644
--- a/test/Spring/Spring.Core.Tests/Context/Support/DelegatingMessageSourceTests.cs
+++ b/test/Spring/Spring.Core.Tests/Context/Support/DelegatingMessageSourceTests.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,14 +18,12 @@
#endregion
-#region Imports
-
using System;
using System.Globalization;
-using NUnit.Framework;
-using Rhino.Mocks;
-#endregion
+using FakeItEasy;
+
+using NUnit.Framework;
namespace Spring.Context.Support
{
@@ -36,16 +34,14 @@ namespace Spring.Context.Support
[TestFixture]
public sealed class DelegatingMessageSourceTests
{
- private MockRepository mocks;
-
- private const string LookupKey = "rick";
+ private const string LookupKey = "rick";
private IMessageSource _messageSource;
private IMessageSource MockMessageSource
{
get
{
- return _messageSource;
+ return _messageSource;
}
}
@@ -55,16 +51,14 @@ private IMessageSource MockMessageSource
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
- _messageSource = mocks.StrictMock();
+ _messageSource = A.Fake();
}
[Test]
public void Instantiation()
{
DelegatingMessageSource source = new DelegatingMessageSource();
- Assert.IsNotNull(source.ParentMessageSource,
- "ParentMessageSource property must *never* be null.");
+ Assert.IsNotNull(source.ParentMessageSource, "ParentMessageSource property must *never* be null.");
}
[Test]
@@ -80,14 +74,11 @@ DelegatingMessageSource source
[Test]
public void GetMessage()
{
- const string expectedName = "Rick Evans";
- Expect.Call(MockMessageSource.GetMessage(LookupKey)).Return(expectedName);
- DelegatingMessageSource source
- = new DelegatingMessageSource(MockMessageSource);
- mocks.ReplayAll();
+ const string expectedName = "Rick Evans";
+ A.CallTo(() => MockMessageSource.GetMessage(LookupKey)).Returns(expectedName);
+ DelegatingMessageSource source = new DelegatingMessageSource(MockMessageSource);
string name = source.GetMessage(LookupKey);
Assert.AreEqual(expectedName, name);
- mocks.VerifyAll();
}
[Test]
@@ -101,13 +92,10 @@ public void GetMessageNoDelegateTarget()
public void GetMessageWithCulture()
{
const string expectedName = "Rick Evans";
- Expect.Call(MockMessageSource.GetMessage(LookupKey, CultureInfo.InvariantCulture)).Return(expectedName);
- DelegatingMessageSource source
- = new DelegatingMessageSource(MockMessageSource);
- mocks.ReplayAll();
+ A.CallTo(() => MockMessageSource.GetMessage(LookupKey, CultureInfo.InvariantCulture)).Returns(expectedName);
+ DelegatingMessageSource source = new DelegatingMessageSource(MockMessageSource);
string name = source.GetMessage(LookupKey, CultureInfo.InvariantCulture);
Assert.AreEqual(expectedName, name);
- mocks.VerifyAll();
}
[Test]
@@ -121,13 +109,10 @@ public void GetMessageWithCultureNoDelegateTarget()
public void GetMessageWithParams()
{
const string expectedName = "Rick Evans";
- Expect.Call(MockMessageSource.GetMessage(LookupKey, new string[] {"Rick", "Evans"})).Return(expectedName);
- DelegatingMessageSource source
- = new DelegatingMessageSource(MockMessageSource);
- mocks.ReplayAll();
- string name = source.GetMessage(LookupKey, "Rick", "Evans");
+ A.CallTo(() => MockMessageSource.GetMessage(LookupKey, new string[] {"Rick", "Evans"})).Returns(expectedName);
+ DelegatingMessageSource source = new DelegatingMessageSource(MockMessageSource);
+ string name = source.GetMessage(LookupKey, "Rick", "Evans");
Assert.AreEqual(expectedName, name);
- mocks.VerifyAll();
}
[Test]
@@ -141,14 +126,10 @@ public void GetMessageWithParamsNoDelegateTarget()
public void GetMessageWithCultureAndParams()
{
const string expectedName = "Rick Evans";
- Expect.Call(MockMessageSource.GetMessage(LookupKey, CultureInfo.InvariantCulture, new string[] {"Rick", "Evans"}))
- .Return(expectedName);
- DelegatingMessageSource source
- = new DelegatingMessageSource(MockMessageSource);
- mocks.ReplayAll();
+ A.CallTo(() => MockMessageSource.GetMessage(LookupKey, CultureInfo.InvariantCulture, new string[] {"Rick", "Evans"})).Returns(expectedName);
+ DelegatingMessageSource source = new DelegatingMessageSource(MockMessageSource);
string name = source.GetMessage(LookupKey, CultureInfo.InvariantCulture, "Rick", "Evans");
Assert.AreEqual(expectedName, name);
- mocks.VerifyAll();
}
[Test]
@@ -162,14 +143,11 @@ public void GetMessageWithCultureAndParamsNoDelegateTarget()
public void GetMessageWithMessageSourceResolvableAndCulture()
{
const string expectedName = "Rick Evans";
- DelegatingMessageSource source
- = new DelegatingMessageSource(MockMessageSource);
- Expect.Call(MockMessageSource.GetMessage((IMessageSourceResolvable)null, CultureInfo.InvariantCulture)).Return(expectedName);
- mocks.ReplayAll();
- string name = source.GetMessage(
- (IMessageSourceResolvable) null, CultureInfo.InvariantCulture);
+ DelegatingMessageSource source = new DelegatingMessageSource(MockMessageSource);
+ A.CallTo(() => MockMessageSource.GetMessage((IMessageSourceResolvable)null, CultureInfo.InvariantCulture)).Returns(expectedName);
+
+ string name = source.GetMessage((IMessageSourceResolvable) null, CultureInfo.InvariantCulture);
Assert.AreEqual(expectedName, name);
- mocks.VerifyAll();
}
[Test]
@@ -177,16 +155,12 @@ public void GetMessageWithNoParentMessageSourceAndMessageSourceResolvableAndCult
{
const string expectedName = "Rick Evans";
- IMessageSourceResolvable resolvable = mocks.StrictMock();
- Expect.Call(resolvable.DefaultMessage).Return(expectedName);
- Expect.Call(resolvable.DefaultMessage).Return(expectedName);
+ IMessageSourceResolvable resolvable = A.Fake();
+ A.CallTo(() => resolvable.DefaultMessage).Returns(expectedName);
DelegatingMessageSource source = new DelegatingMessageSource();
- mocks.ReplayAll();
string name = source.GetMessage(resolvable, CultureInfo.InvariantCulture);
Assert.AreEqual(expectedName, name);
- //mock.Verify();
- mocks.VerifyAll();
}
[Test]
@@ -211,13 +185,10 @@ public void GetMessageWithNoParentMessageSourceAndNullDefaultMessageSourceResolv
public void GetResourceObject()
{
const string expectedName = "Rick Evans";
- Expect.Call(MockMessageSource.GetResourceObject(LookupKey)).Return(expectedName);
- DelegatingMessageSource source
- = new DelegatingMessageSource(MockMessageSource);
- mocks.ReplayAll();
+ A.CallTo(() => MockMessageSource.GetResourceObject(LookupKey)).Returns(expectedName);
+ DelegatingMessageSource source = new DelegatingMessageSource(MockMessageSource);
string name = (string) source.GetResourceObject(LookupKey);
Assert.AreEqual(expectedName, name);
- mocks.VerifyAll();
}
[Test]
@@ -231,13 +202,10 @@ public void GetResourceObjectWithNoParentMessageSource()
public void GetResourceObjectWithCulture()
{
const string expectedName = "Rick Evans";
- Expect.Call(MockMessageSource.GetResourceObject(LookupKey, CultureInfo.InvariantCulture)).Return(expectedName);
- DelegatingMessageSource source
- = new DelegatingMessageSource(MockMessageSource);
- mocks.ReplayAll();
+ A.CallTo(() => MockMessageSource.GetResourceObject(LookupKey, CultureInfo.InvariantCulture)).Returns(expectedName);
+ DelegatingMessageSource source = new DelegatingMessageSource(MockMessageSource);
string name = (string) source.GetResourceObject(LookupKey, CultureInfo.InvariantCulture);
Assert.AreEqual(expectedName, name);
- mocks.VerifyAll();
}
[Test]
@@ -250,12 +218,9 @@ public void GetResourceObjectWithNoParentMessageSourceWithCulture()
[Test]
public void ApplyResources()
{
- MockMessageSource.ApplyResources((object) 12, "rick", CultureInfo.InvariantCulture);
- DelegatingMessageSource source
- = new DelegatingMessageSource(MockMessageSource);
- mocks.ReplayAll();
+ MockMessageSource.ApplyResources(12, "rick", CultureInfo.InvariantCulture);
+ DelegatingMessageSource source = new DelegatingMessageSource(MockMessageSource);
source.ApplyResources(12, "rick", CultureInfo.InvariantCulture);
- mocks.VerifyAll();
}
[Test]
diff --git a/test/Spring/Spring.Core.Tests/Context/Support/MessageSourceAccessorTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/MessageSourceAccessorTests.cs
index 10345a7b3..f9a8ac388 100644
--- a/test/Spring/Spring.Core.Tests/Context/Support/MessageSourceAccessorTests.cs
+++ b/test/Spring/Spring.Core.Tests/Context/Support/MessageSourceAccessorTests.cs
@@ -20,8 +20,9 @@
using System.Globalization;
+using FakeItEasy;
+
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Globalization;
namespace Spring.Context.Support
@@ -47,29 +48,25 @@ public void TestFixtureTearDown()
private readonly string MSGRESULT = "my message";
- private MockRepository mocks;
private IMessageSource mockMsgSource;
private IMessageSourceResolvable mockMsgSourceResolvable;
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
- mockMsgSource = mocks.StrictMock();
- mockMsgSourceResolvable = mocks.StrictMock();
+ mockMsgSource = A.Fake();
+ mockMsgSourceResolvable = A.Fake();
}
[TearDown]
public void TearDown()
{
- mocks.VerifyAll();
}
[Test]
public void GetMessageCodeCultureArgs()
{
- Expect.Call(mockMsgSource.GetMessage(MSGCODE, MSGCULTURE, MSGARGS)).Return(MSGRESULT);
- mocks.ReplayAll();
+ A.CallTo(() => mockMsgSource.GetMessage(MSGCODE, MSGCULTURE, MSGARGS)).Returns(MSGRESULT);
MessageSourceAccessor msgSourceAccessor = new MessageSourceAccessor(mockMsgSource);
Assert.AreEqual(MSGRESULT, msgSourceAccessor.GetMessage(MSGCODE, MSGCULTURE, MSGARGS));
@@ -78,8 +75,7 @@ public void GetMessageCodeCultureArgs()
[Test]
public void GetMessageCodeArgs()
{
- Expect.Call(mockMsgSource.GetMessage(MSGCODE, MSGCULTURE, MSGARGS)).Return(MSGRESULT);
- mocks.ReplayAll();
+ A.CallTo(() => mockMsgSource.GetMessage(MSGCODE, MSGCULTURE, MSGARGS)).Returns(MSGRESULT);
MessageSourceAccessor msgSourceAccessor = new MessageSourceAccessor(mockMsgSource, MSGCULTURE);
Assert.AreEqual(MSGRESULT, msgSourceAccessor.GetMessage(MSGCODE, MSGARGS));
@@ -88,8 +84,7 @@ public void GetMessageCodeArgs()
[Test]
public void GetMessageCodeArgsDefaultsToCurrentUICulture()
{
- Expect.Call(mockMsgSource.GetMessage(MSGCODE, CultureInfo.CurrentUICulture, MSGARGS)).Return(MSGRESULT);
- mocks.ReplayAll();
+ A.CallTo(() => mockMsgSource.GetMessage(MSGCODE, CultureInfo.CurrentUICulture, MSGARGS)).Returns(MSGRESULT);
MessageSourceAccessor msgSourceAccessor = new MessageSourceAccessor(mockMsgSource);
Assert.AreEqual(MSGRESULT, msgSourceAccessor.GetMessage(MSGCODE, MSGARGS));
@@ -98,8 +93,7 @@ public void GetMessageCodeArgsDefaultsToCurrentUICulture()
[Test]
public void GetMessageCodeCulture()
{
- Expect.Call(mockMsgSource.GetMessage(MSGCODE, MSGCULTURE)).Return(MSGRESULT);
- mocks.ReplayAll();
+ A.CallTo(() => mockMsgSource.GetMessage(MSGCODE, MSGCULTURE)).Returns(MSGRESULT);
MessageSourceAccessor msgSourceAccessor = new MessageSourceAccessor(mockMsgSource);
Assert.AreEqual(MSGRESULT, msgSourceAccessor.GetMessage(MSGCODE, MSGCULTURE));
@@ -108,8 +102,7 @@ public void GetMessageCodeCulture()
[Test]
public void GetMessageCodeDefaultsToCurrentUICulture()
{
- Expect.Call(mockMsgSource.GetMessage(MSGCODE, CultureInfo.CurrentUICulture)).Return(MSGRESULT);
- mocks.ReplayAll();
+ A.CallTo(() => mockMsgSource.GetMessage(MSGCODE, CultureInfo.CurrentUICulture)).Returns(MSGRESULT);
MessageSourceAccessor msgSourceAccessor = new MessageSourceAccessor(mockMsgSource);
Assert.AreEqual(MSGRESULT, msgSourceAccessor.GetMessage(MSGCODE));
@@ -118,8 +111,7 @@ public void GetMessageCodeDefaultsToCurrentUICulture()
[Test]
public void GetMessageResolvableCulture()
{
- Expect.Call(mockMsgSource.GetMessage(mockMsgSourceResolvable, MSGCULTURE)).Return(MSGRESULT);
- mocks.ReplayAll();
+ A.CallTo(() => mockMsgSource.GetMessage(mockMsgSourceResolvable, MSGCULTURE)).Returns(MSGRESULT);
MessageSourceAccessor msgSourceAccessor = new MessageSourceAccessor(mockMsgSource);
Assert.AreEqual(MSGRESULT, msgSourceAccessor.GetMessage(mockMsgSourceResolvable, MSGCULTURE));
@@ -128,8 +120,7 @@ public void GetMessageResolvableCulture()
[Test]
public void GetMessageResolvableDefaultsToCurrentUICulture()
{
- Expect.Call(mockMsgSource.GetMessage(mockMsgSourceResolvable, CultureInfo.CurrentUICulture)).Return(MSGRESULT);
- mocks.ReplayAll();
+ A.CallTo(() => mockMsgSource.GetMessage(mockMsgSourceResolvable, CultureInfo.CurrentUICulture)).Returns(MSGRESULT);
MessageSourceAccessor msgSourceAccessor = new MessageSourceAccessor(mockMsgSource);
Assert.AreEqual(MSGRESULT, msgSourceAccessor.GetMessage(mockMsgSourceResolvable));
diff --git a/test/Spring/Spring.Core.Tests/Context/Support/ResourceSetMessageSourceTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/ResourceSetMessageSourceTests.cs
index e87407e19..f8758104d 100644
--- a/test/Spring/Spring.Core.Tests/Context/Support/ResourceSetMessageSourceTests.cs
+++ b/test/Spring/Spring.Core.Tests/Context/Support/ResourceSetMessageSourceTests.cs
@@ -108,17 +108,17 @@ public void DoTestMessageAccess(bool hasParentContext, bool useCodeAsDefaultMess
// MessageSourceAccessor functionality
MessageSourceAccessor accessor = new MessageSourceAccessor(ac);
- Assert.AreEqual("message3", accessor.GetMessage("code3", CultureInfo.CurrentUICulture, (object[])null));
+ Assert.AreEqual("message3", accessor.GetMessage("code3", CultureInfo.CurrentUICulture, null));
// IMessageSourceResolveable
- Assert.AreEqual("message3", ac.GetMessage("code3", CultureInfo.CurrentUICulture, (object[])null));
+ Assert.AreEqual("message3", ac.GetMessage("code3", CultureInfo.CurrentUICulture, null));
IMessageSourceResolvable resolvable = new DefaultMessageSourceResolvable("code3");
Assert.AreEqual("message3", ac.GetMessage(resolvable, CultureInfo.CurrentUICulture));
resolvable = new DefaultMessageSourceResolvable(new string[] { "code4", "code3" });
Assert.AreEqual("message3", ac.GetMessage(resolvable, CultureInfo.CurrentUICulture));
- Assert.AreEqual("message3", ac.GetMessage("code3", CultureInfo.CurrentUICulture, (object[])null));
+ Assert.AreEqual("message3", ac.GetMessage("code3", CultureInfo.CurrentUICulture, null));
resolvable = new DefaultMessageSourceResolvable(new string[] { "code4", "code3" });
Assert.AreEqual("message3", ac.GetMessage(resolvable, CultureInfo.CurrentUICulture));
@@ -130,7 +130,7 @@ public void DoTestMessageAccess(bool hasParentContext, bool useCodeAsDefaultMess
Assert.AreEqual("default", ac.GetMessage(null, "default", CultureInfo.CurrentUICulture, null));
Assert.AreEqual("default", ac.GetMessage(null, "default", CultureInfo.CurrentUICulture, arguments));
- /* not supported
+ /* not supported
Assert.AreEqual("{0}, default", ac.GetMessage(null, "{0}, default", CultureInfo.CurrentUICulture, null));
*/
@@ -142,7 +142,7 @@ public void DoTestMessageAccess(bool hasParentContext, bool useCodeAsDefaultMess
resolvable = new DefaultMessageSourceResolvable(null, arguments, "default");
Assert.AreEqual("default", ac.GetMessage(resolvable, CultureInfo.CurrentUICulture));
- /* not supported
+ /* not supported
resolvable = new DefaultMessageSourceResolvable(null, null, "{0}, default");
Assert.AreEqual("{0}, default", ac.GetMessage(resolvable, CultureInfo.CurrentUICulture));
*/
@@ -154,12 +154,12 @@ public void DoTestMessageAccess(bool hasParentContext, bool useCodeAsDefaultMess
// test message args
Assert.AreEqual("Arg1, Arg2", ac.GetMessage("hello", CultureInfo.CurrentUICulture, new object[] { "Arg1", "Arg2" }));
- /* not supported
+ /* not supported
Assert.AreEqual("{0}, {1}", ac.GetMessage("hello", CultureInfo.CurrentUICulture, null));
*/
- /* not supported
+ /* not supported
Assert.AreEqual("Hello\nWorld", ac.GetMessage("escaped"));
}
else
@@ -277,7 +277,7 @@ private void GetMessageLocalizationFallbacks(IMessageSource msgSource)
Assert.AreEqual("Ово је Spring.NET",
msgSource.GetMessage("MyMessage", new CultureInfo(CultureInfoUtils.SerbianCyrillicCultureName),
new object[] { "Spring", ".NET" }), "message not as expected");
-
+
Assert.AreEqual("Visual Studio voli Spring.NET",
msgSource.GetMessage("MyNewMessage", new CultureInfo(CultureInfoUtils.SerbianCyrillicCultureName), new object[] { "Spring", ".NET" }), "message not as expected");
diff --git a/test/Spring/Spring.Core.Tests/Core/TypeResolution/CachedTypeResolverTests.cs b/test/Spring/Spring.Core.Tests/Core/TypeResolution/CachedTypeResolverTests.cs
index 9e7863b02..287ae2390 100644
--- a/test/Spring/Spring.Core.Tests/Core/TypeResolution/CachedTypeResolverTests.cs
+++ b/test/Spring/Spring.Core.Tests/Core/TypeResolution/CachedTypeResolverTests.cs
@@ -18,45 +18,39 @@
#endregion
-#region Imports
-
using System;
-using NUnit.Framework;
-using Rhino.Mocks;
+using FakeItEasy;
-#endregion
+using NUnit.Framework;
namespace Spring.Core.TypeResolution
{
- ///
- /// Unit tests for the CachedTypeResolver class.
+ ///
+ /// Unit tests for the CachedTypeResolver class.
///
/// Rick Evans
- [TestFixture]
+ [TestFixture]
public sealed class CachedTypeResolverTests
{
- private MockRepository mocks;
-
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
}
[Test]
- public void ResolveWithNullTypeName() {
-
- ITypeResolver mockResolver = (ITypeResolver) mocks.DynamicMock(typeof(ITypeResolver));
+ public void ResolveWithNullTypeName()
+ {
+ ITypeResolver mockResolver = A.Fake();
CachedTypeResolver resolver = new CachedTypeResolver(mockResolver);
Assert.Throws(() => resolver.Resolve(null));
}
- [Test]
- public void InstantiateWithNullTypeResolver()
- {
+ [Test]
+ public void InstantiateWithNullTypeResolver()
+ {
Assert.Throws(() => new CachedTypeResolver(null));
- }
+ }
}
-}
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Core.Tests/Expressions/ExpressionEvaluatorTests.cs b/test/Spring/Spring.Core.Tests/Expressions/ExpressionEvaluatorTests.cs
index 468142dfa..baa489053 100644
--- a/test/Spring/Spring.Core.Tests/Expressions/ExpressionEvaluatorTests.cs
+++ b/test/Spring/Spring.Core.Tests/Expressions/ExpressionEvaluatorTests.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -324,7 +324,7 @@ public void TestExpandoObjectWithNotExistedProperty()
[Test(Description = "SPRNET-944")]
public void DateTests()
{
- string dateLiteral = (string)ExpressionEvaluator.GetValue(null, "'date'");
+ string dateLiteral = (string)ExpressionEvaluator.GetValue(null, "'date'");
Assert.AreEqual("date", dateLiteral);
}
@@ -1739,11 +1739,11 @@ public void TestDelegateFunctionExpressions()
result = (double) ExpressionEvaluator.GetValue(null, "#max(5,25)", vars);
Assert.AreEqual(25, result);
-
+
}
private delegate double DoubleFunction(double arg);
-
+
private double Sqrt(double arg)
{
return Math.Sqrt(arg);
@@ -1820,7 +1820,7 @@ public void TestCountAggregator()
[Test]
public void TestCustomCollectionProcessor()
{
- // Test for the purposes of creating documentation example.
+ // Test for the purposes of creating documentation example.
Dictionary vars = new Dictionary();
vars["EvenSum"] = new IntEvenSumCollectionProcessor();
Assert.AreEqual(6, ExpressionEvaluator.GetValue(null, "{1, 2, 3, 4}.EvenSum()", vars));
@@ -1841,7 +1841,7 @@ public object Process(ICollection source, object[] args)
if ((int)item % 2 == 0)
{
total = NumberUtils.Add(total, item);
- }
+ }
}
else
{
@@ -2308,26 +2308,26 @@ public void TestSetEnumTypePropertyOrFieldFromNumeric()
expField.SetValue(o, TestEnumTypePropertyClass.ESampleEnumType.Trunk);
Assert.AreEqual(TestEnumTypePropertyClass.ESampleEnumType.Trunk, o.SampleEnumField);
- expField.SetValue(o, ((Int16)1));
+ expField.SetValue(o, (short) 1);
Assert.AreEqual(TestEnumTypePropertyClass.ESampleEnumType.Trunk, o.SampleEnumField);
- expField.SetValue(o, ((Int32)1));
+ expField.SetValue(o, 1);
Assert.AreEqual(TestEnumTypePropertyClass.ESampleEnumType.Trunk, o.SampleEnumField);
- expField.SetValue(o, ((Int64)1));
+ expField.SetValue(o, (long) 1);
Assert.AreEqual(TestEnumTypePropertyClass.ESampleEnumType.Trunk, o.SampleEnumField);
// test property set operations
expProperty.SetValue(o, TestEnumTypePropertyClass.ESampleEnumType.Trunk);
Assert.AreEqual(TestEnumTypePropertyClass.ESampleEnumType.Trunk, o.SampleEnumField);
- expProperty.SetValue(o, ((Int16)1));
+ expProperty.SetValue(o, (short) 1);
Assert.AreEqual(TestEnumTypePropertyClass.ESampleEnumType.Trunk, o.SampleEnumField);
- expProperty.SetValue(o, ((Int32)1));
+ expProperty.SetValue(o, 1);
Assert.AreEqual(TestEnumTypePropertyClass.ESampleEnumType.Trunk, o.SampleEnumField);
- expProperty.SetValue(o, ((Int64)1));
+ expProperty.SetValue(o, (long) 1);
Assert.AreEqual(TestEnumTypePropertyClass.ESampleEnumType.Trunk, o.SampleEnumField);
expProperty.SetValue(o, "Trunk");
@@ -2335,7 +2335,7 @@ public void TestSetEnumTypePropertyOrFieldFromNumeric()
try
{
- expProperty.SetValue(o, ((double)1.0));
+ expProperty.SetValue(o, 1.0);
Assert.Fail("should throw");
}
catch (TypeMismatchException e)
diff --git a/test/Spring/Spring.Core.Tests/Globalization/Formatters/FilteringFormatterTests.cs b/test/Spring/Spring.Core.Tests/Globalization/Formatters/FilteringFormatterTests.cs
index 893f58d4c..26767e08c 100644
--- a/test/Spring/Spring.Core.Tests/Globalization/Formatters/FilteringFormatterTests.cs
+++ b/test/Spring/Spring.Core.Tests/Globalization/Formatters/FilteringFormatterTests.cs
@@ -18,17 +18,14 @@
#endregion
-#region Imports
+using FakeItEasy;
using NUnit.Framework;
-using Rhino.Mocks;
-
-#endregion
namespace Spring.Globalization.Formatters
{
///
- ///
+ ///
///
/// Erich Eichinger
[TestFixture]
@@ -47,7 +44,7 @@ protected override string FilterValueToParse(string value)
public virtual string DoFilterValueToParse(string value)
{
- return base.FilterValueToParse(value);
+ return base.FilterValueToParse(value);
}
protected override object FilterValueToFormat(object value)
@@ -65,29 +62,24 @@ public virtual object DoFilterValueToFormat(object value)
[Test]
public void FiltersOnParseAndFormat()
{
- MockRepository mocks = new MockRepository();
- IFormatter underlyingFormatter = mocks.StrictMock();
- TestFilteringFormatter formatter = (TestFilteringFormatter) mocks.PartialMock(typeof (TestFilteringFormatter), underlyingFormatter);
+ IFormatter underlyingFormatter = A.Fake();
+ TestFilteringFormatter formatter = A.Fake(x => x
+ .CallsBaseMethods()
+ .WithArgumentsForConstructor(new[] {underlyingFormatter}));
string inputText = "inputText";
string filteredInputText = "filteredInputText";
object outputValue = new object();
object filteredOutputValue = new object();
- using(mocks.Ordered())
- {
- Expect.Call(formatter.DoFilterValueToParse(inputText)).Return(filteredInputText);
- Expect.Call(underlyingFormatter.Parse(filteredInputText)).Return(outputValue);
+ A.CallTo(() => formatter.DoFilterValueToParse(inputText)).Returns(filteredInputText);
+ A.CallTo(() => underlyingFormatter.Parse(filteredInputText)).Returns(outputValue);
- Expect.Call(formatter.DoFilterValueToFormat(outputValue)).Return(filteredOutputValue);
- Expect.Call(underlyingFormatter.Format(filteredOutputValue)).Return(inputText);
- }
- mocks.ReplayAll();
+ A.CallTo(() => formatter.DoFilterValueToFormat(outputValue)).Returns(filteredOutputValue);
+ A.CallTo(() => underlyingFormatter.Format(filteredOutputValue)).Returns(inputText);
Assert.AreSame(outputValue, formatter.Parse(inputText));
Assert.AreEqual(inputText, formatter.Format(outputValue));
-
- mocks.VerifyAll();
}
}
}
\ No newline at end of file
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/AbstractFactoryObjectTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/AbstractFactoryObjectTests.cs
index 5185be19c..e467a3d47 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/AbstractFactoryObjectTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/AbstractFactoryObjectTests.cs
@@ -18,13 +18,11 @@
#endregion
-#region Imports
-
using System;
-using NUnit.Framework;
-using Rhino.Mocks;
-#endregion
+using FakeItEasy;
+
+using NUnit.Framework;
namespace Spring.Objects.Factory.Config
{
@@ -35,41 +33,38 @@ namespace Spring.Objects.Factory.Config
[TestFixture]
public sealed class AbstractFactoryObjectTests
{
- private MockRepository mocks;
-
[SetUp]
public void Setup()
{
- mocks = new MockRepository();
}
[Test]
public void DisposeCallbackIsNotInvokedOnDisposeIfInPrototypeMode()
{
- IDisposable disposable = mocks.StrictMock();
+ IDisposable disposable = A.Fake();
DummyFactoryObject factory = new DummyFactoryObject(disposable);
- mocks.ReplayAll();
+
factory.IsSingleton = false;
factory.GetObject();
factory.Dispose();
+
// in prototype mode, so the Dispose() method of the object must not be called...
- mocks.VerifyAll();
+ A.CallTo(() => disposable.Dispose()).MustNotHaveHappened();
}
[Test]
public void DisposeCallbackIsInvokedOnDispose()
{
- IDisposable disposable = mocks.StrictMock();
- disposable.Dispose();
- LastCall.On(disposable).Repeat.Once();
- DummyFactoryObject factory = new DummyFactoryObject(disposable);
- mocks.ReplayAll();
+ IDisposable disposable = A.Fake();
+
+ DummyFactoryObject factory = new DummyFactoryObject(disposable);
factory.AfterPropertiesSet();
factory.Dispose();
- mocks.VerifyAll();
+
+ A.CallTo(() => disposable.Dispose()).MustHaveHappenedOnceExactly();
}
- private sealed class DummyFactoryObject : AbstractFactoryObject
+ private sealed class DummyFactoryObject : AbstractFactoryObject
{
public object theObject;
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CommandLineArgsVariableSourceTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CommandLineArgsVariableSourceTests.cs
index fe739a110..b52230814 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CommandLineArgsVariableSourceTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CommandLineArgsVariableSourceTests.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,7 +72,7 @@ public void TestVariablesResolutionWithCustomPrefixAndSeparator()
public void TestLiveVariablesResolutionWithTestDriven()
{
CommandLineArgsVariableSource vs = new CommandLineArgsVariableSource();
- Assert.IsTrue(((string) vs.ResolveVariable("AssemblyName")).StartsWith("TestDriven.TestRunner.Server"));
+ Assert.IsTrue(vs.ResolveVariable("AssemblyName").StartsWith("TestDriven.TestRunner.Server"));
}
}
}
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CustomConverterConfigurerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CustomConverterConfigurerTests.cs
index 53cb8ceeb..b54bc325b 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CustomConverterConfigurerTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CustomConverterConfigurerTests.cs
@@ -18,16 +18,14 @@
#endregion
-#region Imports
-
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
-using NUnit.Framework;
-using Rhino.Mocks;
-#endregion
+using FakeItEasy;
+
+using NUnit.Framework;
namespace Spring.Objects.Factory.Config
{
@@ -38,15 +36,12 @@ namespace Spring.Objects.Factory.Config
[TestFixture]
public sealed class CustomConverterConfigurerTests
{
- private MockRepository mocks;
private IConfigurableListableObjectFactory factory;
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
- factory = mocks.StrictMock();
-
+ factory = A.Fake();
}
[Test]
@@ -93,9 +88,6 @@ public void DontSupplyAnyCustomConverters()
CustomConverterConfigurer config = new CustomConverterConfigurer();
config.CustomConverters = null;
config.PostProcessObjectFactory(factory);
- mocks.ReplayAll();
-
- mocks.VerifyAll();
}
[Test]
@@ -106,21 +98,16 @@ public void SunnyDayScenario()
DateTimeConverter dateTimeConverter = new DateTimeConverter();
Type colorType = typeof(Color);
ColorConverter colorConverter = new ColorConverter();
-
+
converters.Add(dateTimeType, dateTimeConverter);
converters.Add(colorType, colorConverter);
factory.RegisterCustomConverter(dateTimeType, dateTimeConverter);
factory.RegisterCustomConverter(colorType, colorConverter);
- mocks.ReplayAll();
-
CustomConverterConfigurer config = new CustomConverterConfigurer();
config.CustomConverters = converters;
config.PostProcessObjectFactory(factory);
-
- mocks.VerifyAll();
-
}
}
}
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectFactoryCreatingFactoryObjectTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectFactoryCreatingFactoryObjectTests.cs
index 4747c1fe9..cd9b035c6 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectFactoryCreatingFactoryObjectTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectFactoryCreatingFactoryObjectTests.cs
@@ -18,13 +18,11 @@
#endregion
-#region Imports
-
using System;
-using NUnit.Framework;
-using Rhino.Mocks;
-#endregion
+using FakeItEasy;
+
+using NUnit.Framework;
namespace Spring.Objects.Factory.Config
{
@@ -36,28 +34,23 @@ namespace Spring.Objects.Factory.Config
[TestFixture]
public sealed class ObjectFactoryCreatingFactoryObjectTests
{
- private MockRepository mocks;
-
[SetUp]
public void Setup()
{
- mocks = new MockRepository();
}
[Test]
public void SunnyDay()
{
TestObject dude = new TestObject("Rick Evans", 30);
- IObjectFactory objectFactory = mocks.StrictMock();
+ IObjectFactory objectFactory = A.Fake();
const string lookupObjectName = "rick";
- Expect.Call(objectFactory.GetObject(lookupObjectName)).Return(dude).Repeat.Twice();
+ A.CallTo(() => objectFactory.GetObject(lookupObjectName)).Returns(dude).Twice();
ObjectFactoryCreatingFactoryObject factory = new ObjectFactoryCreatingFactoryObject();
factory.ObjectFactory = objectFactory;
factory.TargetObjectName = lookupObjectName;
factory.AfterPropertiesSet();
- mocks.ReplayAll();
-
IGenericObjectFactory gof = (IGenericObjectFactory) factory.GetObject();
IGenericObjectFactory gofOther = (IGenericObjectFactory) factory.GetObject();
Assert.IsTrue(Object.ReferenceEquals(gof, gofOther),
@@ -68,23 +61,21 @@ public void SunnyDay()
Assert.IsNotNull(two, "Must never return null (IFactoryObject contract).");
Assert.IsTrue(Object.ReferenceEquals(one, two),
"Not returning the same instance.");
- mocks.VerifyAll();
}
[Test]
public void PrototypeModeWithSingletonTarget()
{
- TestObject dude = new TestObject("Rick Evans", 30);
- IObjectFactory objectFactory = mocks.StrictMock();
- const string lookupObjectName = "rick";
- Expect.Call(objectFactory.GetObject(lookupObjectName)).Return(dude).Repeat.Twice();
+ TestObject dude = new TestObject("Rick Evans", 30);
+ IObjectFactory objectFactory = A.Fake();
+ const string lookupObjectName = "rick";
+ A.CallTo(() => objectFactory.GetObject(lookupObjectName)).Returns(dude).Twice();
ObjectFactoryCreatingFactoryObject factory = new ObjectFactoryCreatingFactoryObject();
factory.ObjectFactory = objectFactory;
factory.TargetObjectName = lookupObjectName;
factory.IsSingleton = false;
factory.AfterPropertiesSet();
- mocks.ReplayAll();
IGenericObjectFactory gofOne = (IGenericObjectFactory) factory.GetObject();
IGenericObjectFactory gofTwo = (IGenericObjectFactory) factory.GetObject();
Assert.IsFalse(Object.ReferenceEquals(gofOne, gofTwo),
@@ -95,7 +86,6 @@ public void PrototypeModeWithSingletonTarget()
Assert.IsNotNull(two, "Must never return null (IFactoryObject contract).");
Assert.IsTrue(Object.ReferenceEquals(one, two),
"Not returning the same instance to singleton object.");
- mocks.VerifyAll();
}
[Test]
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectReferenceFactoryObjectTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectReferenceFactoryObjectTests.cs
index a5dc0d68c..4c11d6334 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectReferenceFactoryObjectTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectReferenceFactoryObjectTests.cs
@@ -18,115 +18,98 @@
#endregion
-#region Imports
-
using System;
-using NUnit.Framework;
-using Rhino.Mocks;
-#endregion
+using FakeItEasy;
+
+using NUnit.Framework;
namespace Spring.Objects.Factory.Config
{
- ///
- /// Unit tests for the ObjectReferenceFactoryObject class.
+ ///
+ /// Unit tests for the ObjectReferenceFactoryObject class.
///
/// Rick Evans
- [TestFixture]
+ [TestFixture]
public sealed class ObjectReferenceFactoryObjectTests
{
- private MockRepository mocks;
- private IObjectFactory factory;
+ private IObjectFactory factory;
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
- factory = mocks.StrictMock();
+ factory = A.Fake();
}
[Test]
public void NullTargetObjectName()
- {
- ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
+ {
+ ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
// simulate IFactoryObjectAware interface...
Assert.Throws(() => fac.ObjectFactory = null);
}
-
- [Test]
- public void WhitespaceTargetObjectName()
- {
- ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
- fac.TargetObjectName = string.Empty;
+
+ [Test]
+ public void WhitespaceTargetObjectName()
+ {
+ ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
+ fac.TargetObjectName = string.Empty;
// simulate IFactoryObjectAware interface...
Assert.Throws(() => fac.ObjectFactory = null);
- }
-
- [Test]
- public void FactoryDoesNotContainTargetObject()
- {
- Expect.Call(factory.ContainsObject("bojangles")).Return(false);
- mocks.ReplayAll();
-
- ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
- fac.TargetObjectName = "bojangles";
- try
- {
- // simulate IFactoryObjectAware interface...
- fac.ObjectFactory = factory;
- Assert.Fail("Must have bailed with a " +
- "NoSuchObjectDefinitionException 'cos the object doesn't " +
- "exist in the associated factory.");
- }
- catch (NoSuchObjectDefinitionException)
- {
- mocks.VerifyAll();
- }
- }
-
- [Test]
- public void DelegatesThroughToFactoryFor_IsSingleton()
- {
- Expect.Call(factory.ContainsObject("bojangles")).Return(true);
- Expect.Call(factory.IsSingleton("bojangles")).Return(true);
- mocks.ReplayAll();
+ }
+
+ [Test]
+ public void FactoryDoesNotContainTargetObject()
+ {
+ A.CallTo(() => factory.ContainsObject("bojangles")).Returns(false);
ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
- fac.TargetObjectName = "bojangles";
- fac.ObjectFactory = factory;
-
- Assert.IsTrue(fac.IsSingleton);
- mocks.VerifyAll();
- }
-
- [Test]
- public void DelegatesThroughToFactoryFor_GetObject()
- {
- Expect.Call(factory.ContainsObject("bojangles")).Return(true);
- Expect.Call(factory.GetObject("bojangles")).Return("Rick");
- mocks.ReplayAll();
-
- ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
- fac.TargetObjectName = "bojangles";
- fac.ObjectFactory = factory;
-
- Assert.AreEqual("Rick", fac.GetObject());
- mocks.VerifyAll();
- }
-
- [Test]
- public void DelegatesThroughToFactoryFor_ObjectType()
- {
- Expect.Call(factory.ContainsObject("bojangles")).Return(true);
- Expect.Call(factory.GetType("bojangles")).Return(GetType());
- mocks.ReplayAll();
-
- ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
- fac.TargetObjectName = "bojangles";
- fac.ObjectFactory = factory;
-
- Assert.AreEqual(GetType(), fac.ObjectType);
- mocks.VerifyAll();
- }
+ fac.TargetObjectName = "bojangles";
+
+ // simulate IFactoryObjectAware interface...
+ Assert.Throws(() => fac.ObjectFactory = factory,
+ "Must have bailed with a " +
+ "NoSuchObjectDefinitionException 'cos the object doesn't " +
+ "exist in the associated factory.");
+ }
+
+ [Test]
+ public void DelegatesThroughToFactoryFor_IsSingleton()
+ {
+ A.CallTo(() => factory.ContainsObject("bojangles")).Returns(true);
+ A.CallTo(() => factory.IsSingleton("bojangles")).Returns(true);
+
+ ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
+ fac.TargetObjectName = "bojangles";
+ fac.ObjectFactory = factory;
+
+ Assert.IsTrue(fac.IsSingleton);
+ }
+
+ [Test]
+ public void DelegatesThroughToFactoryFor_GetObject()
+ {
+ A.CallTo(() => factory.ContainsObject("bojangles")).Returns(true);
+ A.CallTo(() => factory.GetObject("bojangles")).Returns("Rick");
+
+ ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
+ fac.TargetObjectName = "bojangles";
+ fac.ObjectFactory = factory;
+
+ Assert.AreEqual("Rick", fac.GetObject());
+ }
+
+ [Test]
+ public void DelegatesThroughToFactoryFor_ObjectType()
+ {
+ A.CallTo(() => factory.ContainsObject("bojangles")).Returns(true);
+ A.CallTo(() => factory.GetType("bojangles")).Returns(GetType());
+
+ ObjectReferenceFactoryObject fac = new ObjectReferenceFactoryObject();
+ fac.TargetObjectName = "bojangles";
+ fac.ObjectFactory = factory;
+
+ Assert.AreEqual(GetType(), fac.ObjectType);
+ }
}
-}
+}
\ No newline at end of file
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyOverrideConfigurerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyOverrideConfigurerTests.cs
index 80753be10..f12a1e1d2 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyOverrideConfigurerTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyOverrideConfigurerTests.cs
@@ -18,19 +18,17 @@
#endregion
-#region Imports
-
using System.Collections.Specialized;
using Common.Logging;
using Common.Logging.Simple;
+
+using FakeItEasy;
+
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Context.Support;
using Spring.Core.IO;
using Spring.Objects.Factory.Xml;
-#endregion
-
namespace Spring.Objects.Factory.Config
{
///
@@ -40,13 +38,9 @@ namespace Spring.Objects.Factory.Config
[TestFixture]
public sealed class PropertyOverrideConfigurerTests
{
-
- private MockRepository mocks;
-
[SetUp]
public void Setup()
{
- mocks = new MockRepository();
}
///
@@ -56,7 +50,7 @@ public void Setup()
public void FixtureSetUp()
{
// enable (null appender) logging, just to ensure that the logging code is correct
- LogManager.Adapter = new NoOpLoggerFactoryAdapter();
+ LogManager.Adapter = new NoOpLoggerFactoryAdapter();
}
[Test]
@@ -90,7 +84,7 @@ public void OverridePropertyValue()
pvs.Add("Age", 27);
pvs.Add("Name", "Bruno");
ac.RegisterSingleton("tb1", typeof(TestObject), pvs);
-
+
pvs = new MutablePropertyValues();
pvs.Add("Properties", " ");
ac.RegisterSingleton("configurer", typeof (PropertyOverrideConfigurer), pvs);
@@ -105,11 +99,11 @@ public void OverridePropertyValue()
public void OverridePropertyReference()
{
StaticApplicationContext ac = new StaticApplicationContext();
-
+
MutablePropertyValues pvs = new MutablePropertyValues();
pvs.Add("Spouse", new RuntimeObjectReference("spouse1"));
ac.RegisterSingleton("tb1", typeof(TestObject), pvs);
-
+
ac.RegisterSingleton("spouse1", typeof(TestObject), new MutablePropertyValues());
ac.RegisterSingleton("spouse2", typeof(TestObject), new MutablePropertyValues());
@@ -144,23 +138,15 @@ public void OverridePropertyExpression()
[Test]
public void MalformedOverrideKey()
{
- IConfigurableListableObjectFactory objectFactory = mocks.StrictMock();
+ IConfigurableListableObjectFactory objectFactory = A.Fake();
IConfigurableListableObjectFactory fac = objectFactory;
PropertyOverrideConfigurer cfg = new PropertyOverrideConfigurer();
NameValueCollection defaultProperties = new NameValueCollection();
defaultProperties.Add("malformedKey", "Rick Evans");
cfg.Properties = defaultProperties;
- mocks.ReplayAll();
- try
- {
- cfg.PostProcessObjectFactory(fac);
- Assert.Fail("Should have had a FatalObjectException at this point because of a malformed key.");
- }
- catch (FatalObjectException)
- {
- }
- mocks.VerifyAll();
+
+ Assert.Throws(() => cfg.PostProcessObjectFactory(fac));
}
[Test]
@@ -168,20 +154,17 @@ public void MissingObjectDefinitionDoesntRaiseFatalException()
{
const string valueTo_NOT_BeOveridden = "Jenny Lewis";
TestObject foo = new TestObject(valueTo_NOT_BeOveridden, 30);
- IConfigurableListableObjectFactory objectFactory = mocks.StrictMock();
- Expect.Call(objectFactory.GetObjectDefinition("rubbish")).Return(null);
+ IConfigurableListableObjectFactory objectFactory = A.Fake();
+ A.CallTo(() => objectFactory.GetObjectDefinition("rubbish")).Returns(null);
IConfigurableListableObjectFactory fac = objectFactory;
PropertyOverrideConfigurer cfg = new PropertyOverrideConfigurer();
NameValueCollection defaultProperties = new NameValueCollection();
defaultProperties.Add("rubbish.Name", "Rick Evans");
cfg.Properties = defaultProperties;
- mocks.ReplayAll();
- cfg.PostProcessObjectFactory(fac);
- Assert.AreEqual(valueTo_NOT_BeOveridden, foo.Name,
- "Property value was overridden, but a rubbish objectName root was supplied.");
- mocks.VerifyAll();
+ cfg.PostProcessObjectFactory(fac);
+ Assert.AreEqual(valueTo_NOT_BeOveridden, foo.Name, "Property value was overridden, but a rubbish objectName root was supplied.");
}
[Test]
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPathFactoryObjectTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPathFactoryObjectTests.cs
index 5e35eeca9..4cce955d4 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPathFactoryObjectTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPathFactoryObjectTests.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright � 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,14 +18,12 @@
#endregion
-#region Imports
-
using System;
+
+using FakeItEasy;
using NUnit.Framework;
-using Rhino.Mocks;
-using Spring.Core;
-#endregion
+using Spring.Core;
namespace Spring.Objects.Factory.Config
{
@@ -36,22 +34,19 @@ namespace Spring.Objects.Factory.Config
[TestFixture]
public sealed class PropertyPathFactoryObjectTests
{
- private MockRepository mocks;
private IObjectFactory mockFactory;
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
- mockFactory = mocks.StrictMock();
+ mockFactory = A.Fake();
}
[Test]
public void GetObject_ViaTargetObjectName()
{
- Expect.Call(mockFactory.IsSingleton("foo")).Return(true);
- Expect.Call(mockFactory.GetObject("foo")).Return(new TestObject("Fiona Apple", 28));
- mocks.ReplayAll();
+ A.CallTo(() => mockFactory.IsSingleton("foo")).Returns(true);
+ A.CallTo(() => mockFactory.GetObject("foo")).Returns(new TestObject("Fiona Apple", 28));
PropertyPathFactoryObject fac = new PropertyPathFactoryObject();
fac.TargetObjectName = "foo";
@@ -59,17 +54,15 @@ public void GetObject_ViaTargetObjectName()
fac.ObjectFactory = mockFactory;
string name = (string) fac.GetObject();
Assert.AreEqual("Fiona Apple", name);
- mocks.VerifyAll();
}
[Test]
public void GetObject_ViaTargetObjectNameWithNestedPropertyPath()
{
- Expect.Call(mockFactory.IsSingleton("foo")).Return(true);
+ A.CallTo(() => mockFactory.IsSingleton("foo")).Returns(true);
TestObject target = new TestObject("Fiona Apple", 28);
- target.Spouse = target;
- Expect.Call(mockFactory.GetObject("foo")).Return(target);
- mocks.ReplayAll();
+ target.Spouse = target;
+ A.CallTo(() => mockFactory.GetObject("foo")).Returns(target);
PropertyPathFactoryObject fac = new PropertyPathFactoryObject();
fac.TargetObjectName = "foo";
@@ -77,30 +70,26 @@ public void GetObject_ViaTargetObjectNameWithNestedPropertyPath()
fac.ObjectFactory = mockFactory;
string name = (string) fac.GetObject();
Assert.AreEqual("Fiona Apple", name);
- mocks.VerifyAll();
}
[Test]
public void GetObject_ViaObjectName()
{
- Expect.Call(mockFactory.IsSingleton("foo")).Return(true);
- Expect.Call(mockFactory.GetObject("foo")).Return(new TestObject("Fiona Apple", 28));
- mocks.ReplayAll();
+ A.CallTo(() => mockFactory.GetObject("foo")).Returns(new TestObject("Fiona Apple", 28));
+ A.CallTo(() => mockFactory.IsSingleton("foo")).Returns(true);
PropertyPathFactoryObject fac = new PropertyPathFactoryObject();
fac.ObjectName = "foo.name";
fac.ObjectFactory = mockFactory;
string name = (string) fac.GetObject();
Assert.AreEqual("Fiona Apple", name);
- mocks.VerifyAll();
}
[Test]
public void GetObject_ViaObjectNameThatStartsWithAPeriod()
{
- Expect.Call(mockFactory.IsSingleton("foo")).Return(true);
- Expect.Call(mockFactory.GetObject("foo")).Return(new TestObject("Fiona Apple", 28));
- mocks.ReplayAll();
+ A.CallTo(() => mockFactory.IsSingleton("foo")).Returns(true);
+ A.CallTo(() => mockFactory.GetObject("foo")).Returns(new TestObject("Fiona Apple", 28));
PropertyPathFactoryObject fac = new PropertyPathFactoryObject();
fac.ObjectName = ".foo.name";
@@ -110,41 +99,36 @@ public void GetObject_ViaObjectNameThatStartsWithAPeriod()
[Test]
public void GetObject_MakeSureLeadingAndTrailingWhitspaceIsTrimmed()
{
- Expect.Call(mockFactory.IsSingleton("foo")).Return(true);
- Expect.Call(mockFactory.GetObject("foo")).Return(new TestObject("Fiona Apple", 28));
- mocks.ReplayAll();
+ A.CallTo(() => mockFactory.IsSingleton("foo")).Returns(true);
+ A.CallTo(() => mockFactory.GetObject("foo")).Returns(new TestObject("Fiona Apple", 28));
PropertyPathFactoryObject fac = new PropertyPathFactoryObject();
fac.ObjectName = " \nfoo.name ";
fac.ObjectFactory = mockFactory;
string name = (string) fac.GetObject();
Assert.AreEqual("Fiona Apple", name);
- mocks.VerifyAll();
}
[Test]
public void GetObject_ViaObjectNameWithNestedPropertyPath()
{
- Expect.Call(mockFactory.IsSingleton("foo")).Return(true);
+ A.CallTo(() => mockFactory.IsSingleton("foo")).Returns(true);
TestObject target = new TestObject("Fiona Apple", 28);
- target.Spouse = target;
- Expect.Call(mockFactory.GetObject("foo")).Return(target);
- mocks.ReplayAll();
+ target.Spouse = target;
+ A.CallTo(() => mockFactory.GetObject("foo")).Returns(target);
PropertyPathFactoryObject fac = new PropertyPathFactoryObject();
fac.ObjectName = "foo.spouse.name";
fac.ObjectFactory = mockFactory;
string name = (string) fac.GetObject();
Assert.AreEqual("Fiona Apple", name);
- mocks.VerifyAll();
}
[Test]
public void GetObject_ViaObjectNameWithNullInNestedPropertyPath()
{
- Expect.Call(mockFactory.IsSingleton("foo")).Return(true);
- Expect.Call(mockFactory.GetObject("foo")).Return(new TestObject("Fiona Apple", 28));
- mocks.ReplayAll();
+ A.CallTo(() => mockFactory.IsSingleton("foo")).Returns(true);
+ A.CallTo(() => mockFactory.GetObject("foo")).Returns(new TestObject("Fiona Apple", 28));
PropertyPathFactoryObject fac = new PropertyPathFactoryObject();
fac.ObjectName = "foo.spouse.name";
@@ -154,9 +138,8 @@ public void GetObject_ViaObjectNameWithNullInNestedPropertyPath()
[Test]
public void GetObject_PropertyPathEvaluatesToNull()
{
- Expect.Call(mockFactory.IsSingleton("foo")).Return(true);
- Expect.Call(mockFactory.GetObject("foo")).Return(new TestObject(null, 28));
- mocks.ReplayAll();
+ A.CallTo(() => mockFactory.IsSingleton("foo")).Returns(true);
+ A.CallTo(() => mockFactory.GetObject("foo")).Returns(new TestObject(null, 28));
PropertyPathFactoryObject fac = new PropertyPathFactoryObject();
fac.ObjectName = "foo.name";
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPlaceholderConfigurerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPlaceholderConfigurerTests.cs
index d15490a64..d74e8e9ca 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPlaceholderConfigurerTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPlaceholderConfigurerTests.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright � 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,22 +18,21 @@
#endregion
-#region Imports
-
using System;
using System.Collections;
using System.Collections.Specialized;
using System.IO;
+
+using FakeItEasy;
+
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Collections;
using Spring.Context;
using Spring.Context.Support;
using Spring.Core.IO;
using Spring.Objects.Factory.Support;
using Spring.Objects.Factory.Xml;
-
-#endregion
+using Spring.Util;
namespace Spring.Objects.Factory.Config
{
@@ -44,37 +43,34 @@ namespace Spring.Objects.Factory.Config
[TestFixture]
public sealed class PropertyPlaceholderConfigurerTests
{
- private MockRepository mocks;
private static string testConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Northwind.mdb;User ID=Admin;Password=;";
private static string testConnectionStringTwo = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Northwind.mdb;User ID=Admin;Password=Ernie;";
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
}
[Test]
public void MismatchBetweenNumberOfConfigNamesAndNumberOfLocations()
{
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
- cfg.Locations = new IResource[] { mocks.StrictMock() }; // will never get to the point where we check the validity
+ cfg.Locations = new IResource[] { A.Fake() }; // will never get to the point where we check the validity
cfg.ConfigSections = new string[] { "", "" };
- Assert.Throws(() => cfg.PostProcessObjectFactory((IConfigurableListableObjectFactory) mocks.DynamicMock(typeof(IConfigurableListableObjectFactory))));
+ Assert.Throws(() => cfg.PostProcessObjectFactory(A.Fake()));
}
[Test]
public void OneConfigNameIsOKForLotsOfLocations()
{
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
- IResource mock = mocks.StrictMock();
- Expect.Call(mock.Exists).Return(true);
- Expect.Call(mock.InputStream).Throw(new FileNotFoundException());
- mocks.ReplayAll();
+ IResource mock = A.Fake();
+ A.CallTo(() => mock.Exists).Returns(true);
+ A.CallTo(() => mock.InputStream).Throws(new FileNotFoundException());
cfg.Locations = new IResource [] {mock};
cfg.ConfigSections = new string[] { "" };
- Assert.Throws(() => cfg.PostProcessObjectFactory((IConfigurableListableObjectFactory) mocks.DynamicMock(typeof(IConfigurableListableObjectFactory))));
+ Assert.Throws(() => cfg.PostProcessObjectFactory(A.Fake()));
}
[Test]
@@ -82,13 +78,12 @@ public void ChokesOnBadResourceLocationIfIgnoreBadResourcesFlagNotSetToTrue()
{
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
cfg.IgnoreResourceNotFound = false;
- IResource mock = mocks.StrictMock();
- Expect.Call(mock.Exists).Return(false);
- mocks.ReplayAll();
+ IResource mock = A.Fake();
+ A.CallTo(() => mock.Exists).Returns(false);
cfg.Locations = new IResource [] { mock};
cfg.ConfigSections = new string[] { "" };
- Assert.Throws(() => cfg.PostProcessObjectFactory((IConfigurableListableObjectFactory) mocks.DynamicMock(typeof(IConfigurableListableObjectFactory))));
+ Assert.Throws(() => cfg.PostProcessObjectFactory(A.Fake()));
}
[Test]
@@ -96,17 +91,14 @@ public void DoesNotChokeOnBadResourceLocationIfIgnoreBadResourcesFlagSetToTrue()
{
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
cfg.IgnoreResourceNotFound = true;
- IResource mockResource = mocks.StrictMock();
- Expect.Call(mockResource.Exists).Return(false);
+ IResource mockResource = A.Fake();
+ A.CallTo(() => mockResource.Exists).Returns(false);
cfg.Location = mockResource;
cfg.ConfigSections = new string[] { "" };
- IConfigurableListableObjectFactory mockFactory = (IConfigurableListableObjectFactory)mocks.DynamicMock(typeof(IConfigurableListableObjectFactory));
- Expect.Call(mockFactory.GetObjectDefinitionNames(false)).Return(new string[] {});
- mocks.ReplayAll();
+ IConfigurableListableObjectFactory mockFactory = A.Fake();
+ A.CallTo(() => mockFactory.GetObjectDefinitionNames(false)).Returns(new string[] {});
cfg.PostProcessObjectFactory(mockFactory);
-
- mocks.VerifyAll();
}
[Test]
@@ -143,12 +135,10 @@ public void WithDefaultProperties()
pvs.Add(theProperty, placeholder);
RootObjectDefinition def = new RootObjectDefinition(typeof(TestObject), pvs);
- IConfigurableListableObjectFactory mock = mocks.StrictMock();
- Expect.Call(mock.GetObjectDefinitionNames(false)).Return(new string [] {defName});
- Expect.Call(mock.GetObjectDefinition(defName, false)).Return(def);
- Expect.Call(() => mock.AddEmbeddedValueResolver(null)).IgnoreArguments();
- mocks.ReplayAll();
-
+ IConfigurableListableObjectFactory mock = A.Fake();
+ A.CallTo(() => mock.GetObjectDefinitionNames(false)).Returns(new string [] {defName});
+ A.CallTo(() => mock.GetObjectDefinition(defName, false)).Returns(def);
+
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
NameValueCollection defaultProperties = new NameValueCollection();
const string expectedName = "Rick Evans";
@@ -158,7 +148,7 @@ public void WithDefaultProperties()
Assert.AreEqual(expectedName, def.PropertyValues.GetPropertyValue(theProperty).Value,
"Property placeholder value was not replaced with the resolved value.");
- mocks.VerifyAll();
+ A.CallTo(() => mock.AddEmbeddedValueResolver(A._)).MustHaveHappened();
}
[Test]
@@ -173,11 +163,9 @@ public void IncludingAncestors()
pvs.Add(theProperty, placeholder);
RootObjectDefinition def = new RootObjectDefinition(typeof(TestObject), pvs);
- IConfigurableListableObjectFactory mock = mocks.StrictMock();
- Expect.Call(mock.GetObjectDefinitionNames(true)).Return(new string[] { defName });
- Expect.Call(mock.GetObjectDefinition(defName, true)).Return(def);
- Expect.Call(() => mock.AddEmbeddedValueResolver(null)).IgnoreArguments();
- mocks.ReplayAll();
+ IConfigurableListableObjectFactory mock = A.Fake();
+ A.CallTo(() => mock.GetObjectDefinitionNames(true)).Returns(new string[] { defName });
+ A.CallTo(() => mock.GetObjectDefinition(defName, true)).Returns(def);
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
cfg.IncludeAncestors = true;
@@ -190,14 +178,14 @@ public void IncludingAncestors()
Assert.AreEqual(expectedName, def.PropertyValues.GetPropertyValue(theProperty).Value,
"Property placeholder value was not replaced with the resolved value.");
- mocks.VerifyAll();
+ A.CallTo(() => mock.AddEmbeddedValueResolver(A._)).MustHaveHappened();
}
- ///
- /// Fallback is the default mode. Check if the PROCESSOR_ARCHITECTURE
- /// variable is replaced.
- ///
- [Test]
+ ///
+ /// Fallback is the default mode. Check if the PROCESSOR_ARCHITECTURE
+ /// variable is replaced.
+ ///
+ [Test]
public void WithEnvironmentVariableFallback()
{
StaticApplicationContext ac = new StaticApplicationContext();
@@ -415,10 +403,9 @@ public void ChokesOnCircularReferenceToPlaceHolder()
const string expectedName = "ba${foo}r";
properties.Add("foo", expectedName);
- IConfigurableListableObjectFactory mock = mocks.StrictMock();
- Expect.Call(mock.GetObjectDefinitionNames(false)).Return(new string[] {"foo"});
- Expect.Call(mock.GetObjectDefinition(null, false)).IgnoreArguments().Return(def);
- mocks.ReplayAll();
+ IConfigurableListableObjectFactory mock = A.Fake();
+ A.CallTo(() => mock.GetObjectDefinitionNames(false)).Returns(new string[] {"foo"});
+ A.CallTo(() => mock.GetObjectDefinition(null, false)).WithAnyArguments().Returns(def);
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
cfg.Properties = properties;
@@ -430,7 +417,6 @@ public void ChokesOnCircularReferenceToPlaceHolder()
catch (ObjectDefinitionStoreException)
{
}
- mocks.VerifyAll();
}
[Test]
@@ -446,19 +432,17 @@ public void ReplacesNamedCtorArgument()
const string expectedName = "Rick";
properties.Add("hope.floats", expectedName);
- IConfigurableListableObjectFactory mock = mocks.StrictMock();
- Expect.Call(mock.GetObjectDefinitionNames(false)).Return(new string[] {"foo"});
- Expect.Call(mock.GetObjectDefinition(null, false)).IgnoreArguments().Return(def);
- Expect.Call(delegate { mock.AddEmbeddedValueResolver(null); }).IgnoreArguments();
- mocks.ReplayAll();
+ IConfigurableListableObjectFactory mock = A.Fake();
+ A.CallTo(() => mock.GetObjectDefinitionNames(false)).Returns(new string[] {"foo"});
+ A.CallTo(() => mock.GetObjectDefinition(null, false)).WithAnyArguments().Returns(def);
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
cfg.Properties = properties;
cfg.PostProcessObjectFactory(mock);
- mocks.VerifyAll();
+ A.CallTo(() => mock.AddEmbeddedValueResolver(A._)).MustHaveHappened();
- Assert.AreEqual(expectedName,
+ Assert.AreEqual(expectedName,
def.ConstructorArgumentValues.GetNamedArgumentValue("name").Value,
"Named argument placeholder value was not replaced.");
}
@@ -476,20 +460,18 @@ public void UsingCustomMarkers()
const string expectedName = "Rick";
properties.Add("hope.floats", expectedName);
- IConfigurableListableObjectFactory mock = mocks.StrictMock();
- Expect.Call(mock.GetObjectDefinitionNames(false)).Return(new string[] {"foo"});
- Expect.Call(mock.GetObjectDefinition(null, false)).IgnoreArguments().Return(def);
- Expect.Call(() => mock.AddEmbeddedValueResolver(null)).IgnoreArguments();
- mocks.ReplayAll();
+ IConfigurableListableObjectFactory mock = A.Fake();
+ A.CallTo(() => mock.GetObjectDefinitionNames(false)).Returns(new string[] {"foo"});
+ A.CallTo(() => mock.GetObjectDefinition(null, false)).WithAnyArguments().Returns(def);
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
cfg.PlaceholderPrefix = cfg.PlaceholderSuffix = "#";
cfg.Properties = properties;
cfg.PostProcessObjectFactory(mock);
- mocks.VerifyAll();
+ A.CallTo(() => mock.AddEmbeddedValueResolver(null)).WithAnyArguments().MustHaveHappened();
- Assert.AreEqual(expectedName,
+ Assert.AreEqual(expectedName,
def.ConstructorArgumentValues.GetNamedArgumentValue("name").Value,
"Named argument placeholder value was not replaced.");
}
@@ -574,21 +556,19 @@ public void WithIgnoreUnresolvablePlaceholder()
pvs.Add("name", placeholder);
RootObjectDefinition def = new RootObjectDefinition(typeof(TestObject), pvs);
- IConfigurableListableObjectFactory mock = mocks.StrictMock();
- Expect.Call(mock.GetObjectDefinitionNames(false)).Return(new string [] {defName});
- Expect.Call(mock.GetObjectDefinition(defName, false)).Return(def);
- Expect.Call(() => mock.AddEmbeddedValueResolver(null)).IgnoreArguments();
- mocks.ReplayAll();
+ IConfigurableListableObjectFactory mock = A.Fake();
+ A.CallTo(() => mock.GetObjectDefinitionNames(false)).Returns(new string [] {defName});
+ A.CallTo(() => mock.GetObjectDefinition(defName, false)).Returns(def);
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
cfg.IgnoreUnresolvablePlaceholders = true;
cfg.PostProcessObjectFactory(mock);
Assert.AreEqual(placeholder, foo.Name);
- mocks.VerifyAll();
+ A.CallTo(() => mock.AddEmbeddedValueResolver(null)).WithAnyArguments().MustHaveHappened();
}
- [Test]
+ [Test]
public void ViaXML()
{
IResource resource = new ReadOnlyXmlTestResource("PropertyResourceConfigurerTests.xml", GetType());
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ResourceHandlerConfigurerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ResourceHandlerConfigurerTests.cs
index 37c1357c4..c028bab44 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ResourceHandlerConfigurerTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ResourceHandlerConfigurerTests.cs
@@ -19,16 +19,16 @@
#endregion
using System.Collections;
-using NUnit.Framework;
-using Rhino.Mocks;
+using FakeItEasy;
+
+using NUnit.Framework;
using Spring.Core.IO;
using Spring.Util;
namespace Spring.Objects.Factory.Config
{
-
///
/// Unit tests for the TypeAliasConfigurer class
///
@@ -36,12 +36,9 @@ namespace Spring.Objects.Factory.Config
[TestFixture]
public class ResourceHandlerConfigurerTests
{
- private MockRepository mocks;
-
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
}
[Test]
@@ -68,7 +65,7 @@ public void UseInvalidTypeForDictionaryValue()
ResourceHandlerConfigurer resourceHandlerConfiguer = new ResourceHandlerConfigurer();
resourceHandlerConfiguer.ResourceHandlers = resourceHandlers;
- Assert.Throws(() => resourceHandlerConfiguer.PostProcessObjectFactory((IConfigurableListableObjectFactory) mocks.DynamicMock(typeof(IConfigurableListableObjectFactory))));
+ Assert.Throws(() => resourceHandlerConfiguer.PostProcessObjectFactory(A.Fake()));
}
[Test]
@@ -81,7 +78,7 @@ public void UseNonResolvableTypeForDictionaryValue()
resourceHandlerConfiguer.ResourceHandlers = resourceHandlers;
- Assert.Throws(() => resourceHandlerConfiguer.PostProcessObjectFactory((IConfigurableListableObjectFactory) mocks.DynamicMock(typeof(IConfigurableListableObjectFactory))));
+ Assert.Throws(() => resourceHandlerConfiguer.PostProcessObjectFactory(A.Fake()));
}
[Test]
@@ -112,7 +109,7 @@ private void CreateConfigurerAndTestNewProtcol(IDictionary resourceHandlers)
resourceHandlerConfiguer.Order = 1;
- resourceHandlerConfiguer.PostProcessObjectFactory((IConfigurableListableObjectFactory) mocks.DynamicMock(typeof(IConfigurableListableObjectFactory)));
+ resourceHandlerConfiguer.PostProcessObjectFactory(A.Fake());
//todo investigate mocking the typeregistry, for now ask the actual one for information.
Assert.IsTrue(ResourceHandlerRegistry.IsHandlerRegistered("httpsss"),
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/SharedStateAwareProcessorTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/SharedStateAwareProcessorTests.cs
index c113e93e3..70d615f9d 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/SharedStateAwareProcessorTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/SharedStateAwareProcessorTests.cs
@@ -1,7 +1,7 @@
#region License
/*
- * Copyright � 2002-2011 the original author or authors.
+ * Copyright � 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,8 +22,10 @@
using System;
using System.Collections;
+
+using FakeItEasy;
using NUnit.Framework;
-using Rhino.Mocks;
+
using Spring.Objects.Factory.Support;
using Spring.Objects.Support;
@@ -113,25 +115,19 @@ public void IgnoresAlreadyPopulatedState()
{
DefaultListableObjectFactory of = new DefaultListableObjectFactory();
- MockRepository mocks = new MockRepository();
- ISharedStateFactory ssf1 = mocks.StrictMock();
- ISharedStateAware ssa = (ISharedStateAware)mocks.DynamicMock( typeof( ISharedStateAware ) );
+ ISharedStateFactory ssf1 = A.Fake();
+ ISharedStateAware ssa = A.Fake();
SharedStateAwareProcessor ssap = new SharedStateAwareProcessor();
- ssap.SharedStateFactories = new ISharedStateFactory[] { ssf1 };
- of.RegisterSingleton( "ssap", ssap );
+ ssap.SharedStateFactories = new ISharedStateFactory[] {ssf1};
+ of.RegisterSingleton("ssap", ssap);
- using (Record( mocks ))
- {
- // preset SharedState - ssap must ignore it
- Expect.Call( ssa.SharedState ).Return( new Hashtable() );
- // expect nothing else!
- }
+ // preset SharedState - ssap must ignore it
+ A.CallTo(() => ssa.SharedState).Returns(new Hashtable());
- using (Playback( mocks ))
- {
- ssap.PostProcessBeforeInitialization( ssa, "myPage" );
- }
+ ssap.PostProcessBeforeInitialization(ssa, "myPage");
+
+ A.CallTo(ssa).Where(x => x.Method.Name == "set_SharedState").MustNotHaveHappened();
}
[Test]
@@ -139,53 +135,33 @@ public void ProbesSharedStateFactories()
{
DefaultListableObjectFactory of = new DefaultListableObjectFactory();
- MockRepository mocks = new MockRepository();
- ISharedStateFactory ssf1 = mocks.StrictMock();
- ISharedStateFactory ssf2 = mocks.StrictMock();
- ISharedStateFactory ssf3 = mocks.StrictMock();
- ISharedStateFactory ssf4 = mocks.StrictMock();
+ ISharedStateFactory ssf1 = A.Fake();
+ ISharedStateFactory ssf2 = A.Fake();
+ ISharedStateFactory ssf3 = A.Fake();
+ ISharedStateFactory ssf4 = A.Fake();
IDictionary ssf3ProvidedState = new Hashtable();
SharedStateAwareProcessor ssap = new SharedStateAwareProcessor();
- ssap.SharedStateFactories = new ISharedStateFactory[] { ssf1, ssf2, ssf3, ssf4 };
- of.RegisterSingleton( "ssap", ssap );
+ ssap.SharedStateFactories = new ISharedStateFactory[] {ssf1, ssf2, ssf3, ssf4};
+ of.RegisterSingleton("ssap", ssap);
- ISharedStateAware ssa = (ISharedStateAware)mocks.DynamicMock( typeof( ISharedStateAware ) );
+ ISharedStateAware ssa = A.Fake();
// Ensure we iterate over configured SharedStateFactories until
// the first provider is found that
// a) true == provider.CanProvideState( instance, name )
// b) null != provider.GetSharedState( instance, name )
- using (Record( mocks ))
- {
- Expect.Call( ssa.SharedState ).Return( null );
- Expect.Call( ssf1.CanProvideState( ssa, "pageName" ) ).Return( false );
- Expect.Call( ssf2.CanProvideState( ssa, "pageName" ) ).Return( true );
- Expect.Call( ssf2.GetSharedStateFor( ssa, "pageName" ) ).Return( null );
- Expect.Call( ssf3.CanProvideState( ssa, "pageName" ) ).Return( true );
- Expect.Call( ssf3.GetSharedStateFor( ssa, "pageName" ) ).Return( ssf3ProvidedState );
- Expect.Call( ssa.SharedState = ssf3ProvidedState );
- }
-
- using (Playback( mocks ))
- {
- ssap.PostProcessBeforeInitialization( ssa, "pageName" );
- }
- }
+ A.CallTo(() => ssa.SharedState).Returns(null).Once();
+ A.CallTo(() => ssf1.CanProvideState(ssa, "pageName")).Returns(false).Once();
+ A.CallTo(() => ssf2.CanProvideState(ssa, "pageName")).Returns(true).Once();
+ A.CallTo(() => ssf2.GetSharedStateFor(ssa, "pageName")).Returns(null);
+ A.CallTo(() => ssf3.CanProvideState(ssa, "pageName")).Returns(true).Once();
+ A.CallTo(() => ssf3.GetSharedStateFor(ssa, "pageName")).Returns(ssf3ProvidedState).Once();
- #region Rhino.Mocks Compatibility Adapter
+ ssap.PostProcessBeforeInitialization(ssa, "pageName");
- private static IDisposable Record( MockRepository mocks )
- {
- return mocks.Record();
+ Assert.That(Equals(ssa.SharedState, ssf3ProvidedState));
}
-
- private static IDisposable Playback( MockRepository mocks )
- {
- return mocks.Playback();
- }
-
- #endregion Rhino.Mocks Compatibility Adapter
}
}
\ No newline at end of file
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/TypeAliasConfigurerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/TypeAliasConfigurerTests.cs
index f1f71e943..fd827aa0f 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/TypeAliasConfigurerTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/TypeAliasConfigurerTests.cs
@@ -20,8 +20,10 @@
using System;
using System.Collections;
+
+using FakeItEasy;
+
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Collections;
using Spring.Context.Support;
using Spring.Core.TypeResolution;
@@ -37,14 +39,12 @@ namespace Spring.Objects.Factory.Config
[TestFixture]
public class TypeAliasConfigurerTests
{
- private MockRepository mocks;
private IConfigurableListableObjectFactory factory;
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
- factory = mocks.StrictMock();
+ factory = A.Fake();
}
[Test]
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/VariablePlaceholderConfigurerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/VariablePlaceholderConfigurerTests.cs
index 825f49ee2..7db159398 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/VariablePlaceholderConfigurerTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/VariablePlaceholderConfigurerTests.cs
@@ -21,9 +21,9 @@
using System;
using System.Collections;
-using NUnit.Framework;
+using FakeItEasy;
-using Rhino.Mocks;
+using NUnit.Framework;
using Spring.Context.Support;
using Spring.Objects.Factory.Support;
@@ -31,18 +31,15 @@
namespace Spring.Objects.Factory.Config
{
///
- /// This class contains tests for
+ /// This class contains tests for
///
/// Mark Pollack
[TestFixture]
public class VariablePlaceholderConfigurerTests
{
- private MockRepository mocks;
-
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
}
[Test]
@@ -68,7 +65,7 @@ public void ThrowsOnInvalidVariableSourcesElement()
StaticApplicationContext ac = new StaticApplicationContext();
VariablePlaceholderConfigurer vphc = new VariablePlaceholderConfigurer();
vphc.VariableSources = new ArrayList(new object[] { new object() });
-
+
try
{
vphc.PostProcessObjectFactory(ac.ObjectFactory);
@@ -300,10 +297,9 @@ public void InlcludeAncestors()
pvs.Add(theProperty, placeholder);
RootObjectDefinition def = new RootObjectDefinition(typeof(TestObject), pvs);
- IConfigurableListableObjectFactory mock = mocks.StrictMock();
- Expect.Call(mock.GetObjectDefinitionNames(true)).Return(new string[] { defName });
- Expect.Call(mock.GetObjectDefinition(defName, true)).Return(def);
- mocks.ReplayAll();
+ IConfigurableListableObjectFactory mock = A.Fake();
+ A.CallTo(() => mock.GetObjectDefinitionNames(true)).Returns(new string[] { defName });
+ A.CallTo(() => mock.GetObjectDefinition(defName, true)).Returns(def);
VariablePlaceholderConfigurer vpc = new VariablePlaceholderConfigurer();
vpc.IgnoreUnresolvablePlaceholders = true;
@@ -311,8 +307,6 @@ public void InlcludeAncestors()
vpc.IncludeAncestors = true;
vpc.PostProcessObjectFactory(mock);
-
- mocks.VerifyAll();
}
}
}
\ No newline at end of file
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/DefaultListableObjectFactoryTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/DefaultListableObjectFactoryTests.cs
index 8a0829bc6..e87214b5d 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/DefaultListableObjectFactoryTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/DefaultListableObjectFactoryTests.cs
@@ -18,8 +18,6 @@
#endregion
-#region Imports
-
using System;
using System.Collections;
using System.Collections.Generic;
@@ -27,15 +25,12 @@
using System.Reflection;
using System.Runtime.Serialization;
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Core.TypeConversion;
using Spring.Objects.Factory.Config;
using Spring.Objects.Factory.Support;
using Spring.Objects.Factory.Xml;
using Spring.Objects.Support;
-#endregion
-
namespace Spring.Objects.Factory
{
///
@@ -46,13 +41,11 @@ namespace Spring.Objects.Factory
[TestFixture]
public sealed class DefaultListableObjectFactoryTests
{
- private MockRepository mocks;
-
[SetUp]
public void Setup()
{
- mocks = new MockRepository();
}
+
///
/// The setup logic executed before the execution of this test fixture.
///
@@ -79,7 +72,7 @@ public Class1( ICollaborator collaborator, IStrategy strategy)
TheStrategy = strategy;
}
}
-
+
class Class2
{
private IStrategy _strategy;
@@ -293,8 +286,8 @@ public void Dispose()
[Test]
public void GetObjectPostProcessorCount()
{
- IObjectPostProcessor proc1 = mocks.StrictMock();
- IObjectPostProcessor proc2 = mocks.StrictMock();
+ IObjectPostProcessor proc1 = FakeItEasy.A.Fake();
+ IObjectPostProcessor proc2 = FakeItEasy.A.Fake();
DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
@@ -315,9 +308,8 @@ public void GetObjectPostProcessorCount()
[Test]
public void GetObjectPostProcessorCountDoesntRespectHierarchy()
{
-
- IObjectPostProcessor proc1 = mocks.StrictMock();
- IObjectPostProcessor proc2 = mocks.StrictMock();
+ IObjectPostProcessor proc1 = FakeItEasy.A.Fake();
+ IObjectPostProcessor proc2 = FakeItEasy.A.Fake();
DefaultListableObjectFactory child = new DefaultListableObjectFactory();
DefaultListableObjectFactory parent = new DefaultListableObjectFactory(child);
@@ -1535,7 +1527,7 @@ public void DoubleBooleanAutowire()
DefaultListableObjectFactory fac = new DefaultListableObjectFactory();
fac.RegisterObjectDefinition("foo", def);
- Assert.Throws(() => fac.GetObject("foo"),
+ Assert.Throws(() => fac.GetObject("foo"),
"Error creating object with name 'foo' : Unsatisfied dependency " +
"expressed through constructor argument with index 1 of type [System.Boolean] : " +
"No unique object of type [System.Boolean] is defined : Unsatisfied dependency of type [System.Boolean]: expected at least 1 matching object to wire the [b2] parameter on the constructor of object [foo]");
@@ -1650,7 +1642,7 @@ public void GetObjectDefinitionResolvesAliases()
[Test]
public void IgnoreObjectPostProcessorDuplicates()
{
- IObjectPostProcessor proc1 = mocks.StrictMock();
+ IObjectPostProcessor proc1 = FakeItEasy.A.Fake();
DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
@@ -1706,7 +1698,7 @@ public void ConfigureObjectAppliesObjectPostProcessorsUsingDefinition()
object testObject = "TestObject";
object resultObject = of.ConfigureObject(testObject, "myObjectDefinition");
- Assert.AreSame(wrapperObject, resultObject);
+ Assert.AreSame(wrapperObject, resultObject);
}
[Test]
@@ -1715,10 +1707,10 @@ public void ConfigureObjectDoesNotApplyObjectPostProcessorsIfNoDefinition()
DefaultListableObjectFactory of = new DefaultListableObjectFactory();
object wrapperObject = "WrapperObject";
of.AddObjectPostProcessor( new TestObjectPostProcessor(wrapperObject));
-
+
object testObject = "TestObject";
object resultObject = of.ConfigureObject(testObject, "non-existant definition");
- Assert.AreSame(testObject, resultObject);
+ Assert.AreSame(testObject, resultObject);
}
[Test]
diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/ObjectDefinitionStoreExceptionTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/ObjectDefinitionStoreExceptionTests.cs
index ad06f0cad..d03931d50 100644
--- a/test/Spring/Spring.Core.Tests/Objects/Factory/ObjectDefinitionStoreExceptionTests.cs
+++ b/test/Spring/Spring.Core.Tests/Objects/Factory/ObjectDefinitionStoreExceptionTests.cs
@@ -18,15 +18,12 @@
#endregion
-#region Imports
+using FakeItEasy;
using NUnit.Framework;
-using Rhino.Mocks;
using Spring.Core.IO;
using Spring.Util;
-#endregion
-
namespace Spring.Objects.Factory
{
///