Is there any way to use EasyMock with C# Properties? It seems to detect the get_MyProperty that is under the covers but I don't seem to be able to set a return value.
Thanks,
Julian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm wondering this as well. I keep getting "incompatible return value type" messages when I set a return value for a property as opposed to a pure method. Quite aggravating as most of the things I need to test right now happen to be properties!
Otherwise, great port. I like it a lot.
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Are you running under VS2005, though? If so, that could explain the problem - there's an issue with void methods (such as property setters) in .NET 2.0.
There's another post in the forums giving a workaround. However, that may not be the issue here...
Could you come up with a failing NUnit test?
(Of course, it's possible that I've fixed it in my development version... some time I *will* find time to release stuff!)
Jon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Jon, I'm running VS2003 and .NET 1.1. I can't really send a failing test because what I'm testing is a class internal to the company I work for. I'll see if I can come up with something against one of .NET's built-in classes, though.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Jon, I gave this about 10 minutes but was having trouble with NUnit assembly conflicts on my machine (so much for .NET eliminating DLL hell) so I gave up. I've switched to using NUnit's mocks which, while not as robust, at least appear to handle my code better. I'd really like to provide you with a failing test, but I can't justify the time since it looks like it'll take a while to get everything setup again. Sorry.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just as a thought - if you were trying to set the return value by setting the property, that wouldn't work. Instead, you need to access the property, then use SetReturnValue or whatever to set the return value.
Anyway, if you ever do get a chance to find an example, I'll be happy to take a look.
Jon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there any way to use EasyMock with C# Properties? It seems to detect the get_MyProperty that is under the covers but I don't seem to be able to set a return value.
Thanks,
Julian
I'm wondering this as well. I keep getting "incompatible return value type" messages when I set a return value for a property as opposed to a pure method. Quite aggravating as most of the things I need to test right now happen to be properties!
Otherwise, great port. I like it a lot.
Matt
You should be able to use properties fine.
Are you running under VS2005, though? If so, that could explain the problem - there's an issue with void methods (such as property setters) in .NET 2.0.
There's another post in the forums giving a workaround. However, that may not be the issue here...
Could you come up with a failing NUnit test?
(Of course, it's possible that I've fixed it in my development version... some time I *will* find time to release stuff!)
Jon
Jon, I'm running VS2003 and .NET 1.1. I can't really send a failing test because what I'm testing is a class internal to the company I work for. I'll see if I can come up with something against one of .NET's built-in classes, though.
You shouldn't need to post any sensitive code - just a test class and a class which has a property.
Jon
Jon, I gave this about 10 minutes but was having trouble with NUnit assembly conflicts on my machine (so much for .NET eliminating DLL hell) so I gave up. I've switched to using NUnit's mocks which, while not as robust, at least appear to handle my code better. I'd really like to provide you with a failing test, but I can't justify the time since it looks like it'll take a while to get everything setup again. Sorry.
Okay - not to worry.
Just as a thought - if you were trying to set the return value by setting the property, that wouldn't work. Instead, you need to access the property, then use SetReturnValue or whatever to set the return value.
Anyway, if you ever do get a chance to find an example, I'll be happy to take a look.
Jon