views:

47

answers:

4

Hi,

I am used to using JMock in Java which allows you to specify things such as any(String.class) as an expected argument - which .NET frameworks offer similar functionality?

A: 

MOQ has this functionality. I don't know about any of the other available frameworks.

Leslie
+1  A: 

I've used both Rhino Mocks and Moq and they both have this functionality.

Garry Shutler
+2  A: 

MOQ allows you specify constraints, such as

mock.Setup(x => x.DoStuff(It.IsAny<string>())).Returns("Foo");

There are other constraints available as well.

Rhino Mocks have basically the same feature set.

Mark Seemann
+2  A: 

In TypeMock the default is don't care for specific arguments. So unless you want to check specific arguments, you just set up you mock to return whatever needs to be returned.

Brian Rasmussen