Passing this class as to Args as a Parameter Checker to mock ref and out parameters. Enterprise
Edition users can swap normal argument too.
See IParameters
Inheritance Hierarchy
TypeMockAssign
Namespace: TypeMock
Assembly: TypeMock (in TypeMock.dll) Version: 9.3.6.0 (9.3.6.0)
Syntax
The Assign type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | Assign |
Create a new Assign object that will mock ref and out arguments
|
Methods
Name | Description | |
---|---|---|
![]() | AndCheck |
Validate the parameter before assigning it a value.
|
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | IsCheckingSameType |
A boolean method the checks if the "other" object is the same type as the object that called the method.
|
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Remarks
[Test] public void CheckRefAndOut() { Mock mock = MockManager.Mock(typeof(TestedClass)); TestedClass t = new TestedClass(); // Check that first arg is "rr" and assign it with "changed" // Assign the second arg with 3, don't check (same as Check.IsAny()) mock.ExpectCall("SomeMethod").Args(new Assign("changed").AndCheck("rr"), new Assign(3)); int a ; string s = "rr"; t.SomeMethod(ref s,out a); Assert.AreEqual(3,a); Assert.AreEqual("changed",s); MockManager.Verify(); }
![]() |
---|
Typemock Isolator doesn't check that the parameter is actually passed by ref |
![]() |
---|
Assign will might work correctly for un-mocked expectations. See CONTINUE_WITH_METHOD |
![]() |
---|
Assigning arrays is currently not supported |
See Also