|
From: Steve F. <st...@m3...> - 2004-11-01 16:25:47
|
Have you looked at how jmock works? Nat will be rolling onto a .Net
project soon, so I expect we'll finally have someone with the motivation
to do something about a port (making promises on his behalf).
S.
Levi Khatskevitch wrote:
> I had the same idea a while ago, but how would you handle argument
> constraints like NotNull() that do not specify the argument type? Losing
> them will make expectations more verbose but on the other hand requiring
> too precise expectations often results in unit tests that follow real code
> too closely - a common problem with interaction base testing that I've
> seen.
>
> Recently I was thinking about resolving methods to the first expectation
> in the call sequence where argument types match. This preserves the
> flexibility but also supports overloading in a more consistent way. For
> example:
>
> mock.Expect("Foo", new IsAnything()); // expect either overload
> mock.Expect("Foo", (int)1); // expect Foo(int) overload
> mock.Expect("Foo", (double)1.2); // expect Foo(double) overload
>
> mock.Invoke("Foo", 2); // ok, resolved to the first expectation
> mock.Invoke("Foo", 1.0); // fail, resolves to the third expectation and
> thus should be 1.2
>
> Any thoughts on this?
>
> Regards,
> - Levi
>
>
>
>
> Jim Arnold <JA...@th...>
> Sent by: nmo...@li...
> 11/01/2004 08:41 AM
>
> To
> nmo...@li...
> cc
>
> Subject
> [Nmock-general] MethodSignature and friends
>
>
>
>
>
>
> The method resolution in NMock is really starting to annoy me :-) It
> works for simple cases (find a method named "Foo" with a return type of
> "Bar"), but complex scenarios with overloads and indexed properties are
> still buggy. The fundamental problem is that the user is not forced to
> specify the attributes necessary to find a method. SetupResult() can just
> take a method name and a return value, which is really not enough to
> resolve overloaded properties.
>
> We should just get rid of the whole MethodSignature thing and start using
> real MethodInfos and PropertyInfos instead. It might make the public API
> slightly more complex, but would close a whole class of bugs.
>
> Can I get a +/- 1 from anybody?
>
> Jim
> ------------------------------------------------------- This SF.Net email
> is sponsored by: Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_idU88&alloc_id065&op=click
> _______________________________________________ Nmock-general mailing list
> Nmo...@li...
> https://lists.sourceforge.net/lists/listinfo/nmock-general
>
|