I dug through the forums and found this post
http://www.telerik.com/community/forums/justmock/general-discussions/how-to-set-up-property-assignment.aspx
I have the Free Edition, Telerik.JustMock.dll File Version 2011.1.315.0
The promise of a build available next week in August 2010, doesn't prove to work with Behavior.CallOriginal. (an empty Constructor works though).
Here is a sample of my TestMethod
I tried the above code with no parameters for the constructor, all 3 behaviour enums for the Constructor, but nothing works.
I tried to do some code where I stored the name parameter as a local variable to the test and implement my own logic, but I can't seem to get the actual value in ArrangeSet. I tried to do something like:
But there is nothing like that. Is there another solution?
Thanks
http://www.telerik.com/community/forums/justmock/general-discussions/how-to-set-up-property-assignment.aspx
I have the Free Edition, Telerik.JustMock.dll File Version 2011.1.315.0
The promise of a build available next week in August 2010, doesn't prove to work with Behavior.CallOriginal. (an empty Constructor works though).
Here is a sample of my TestMethod
public
interface
ISamplePoco
{
string
Name {
get
;
set
; }
}
[TestMethod]
public
void
GenerateMockWithPocoPropertyBehaviour()
{
// arrange
var target = Mock.Create<ISamplePoco>(Behavior.CallOriginal);
// act
target.Name =
"Dude"
;
target.Name +=
"s"
;
// assert
Assert.AreEqual(
"Dudes"
, target.Name);
}
I tried the above code with no parameters for the constructor, all 3 behaviour enums for the Constructor, but nothing works.
I tried to do some code where I stored the name parameter as a local variable to the test and implement my own logic, but I can't seem to get the actual value in ArrangeSet. I tried to do something like:
string
name =
string
.Empty;
Mock.Arrange(() => target.Name).Returns(name);
Mock.ArrangeSet((
string
val) => { name = val; }).IgnoreArguments();
But there is nothing like that. Is there another solution?
Thanks