Nosrama
Nosrama

Reputation: 14964

What .NET mocking frameworks allow me to specify ANYTHING as an expected argument?

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?

Upvotes: 1

Views: 97

Answers (4)

Brian Rasmussen
Brian Rasmussen

Reputation: 116401

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.

Upvotes: 2

Mark Seemann
Mark Seemann

Reputation: 233150

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.

Upvotes: 2

Garry Shutler
Garry Shutler

Reputation: 32698

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

Upvotes: 1

user56737
user56737

Reputation:

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

Upvotes: 0

Related Questions