tags:

views:

41

answers:

1

Given the following:

var mockIActionService = new Mock<IActionService>();
var mockValidAgeRule = new Mock<ValidAgeRule>(mockIActionService.Object);
mockValidAgeRule.Setup(t => t.Execute(app));

Now t.Execute returns a "Rules" object, how can I verify that something has been called on Rules?

I am attempting to call it as such mockValidAgeRule.Verify(x => x.Execute(app).Passed)

I want to test that the object Result returned true given the inputs.

Sorry for all questions just am having a little trouble finding info about MOQ that is up to date and helpful

A: 

Well, as stated by Chris, you haven't provided enough detail to get a proper answer. Nonetheless, IMHO it's pretty clear that this test has a code smell. It don't appear to have any concrete implementations. A test completely composed of mock objects is not likely testing anything useful.

Which class represents your SUT? It sounds like it might be your Rules object. If you provide further detail about your object model and expected behaviors, it would be easier to provide a feedback.

Hans Gruber