McKelt.com

Remembering Thoughts

 

Recent comments

Authors

Categories


Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

Rhino Mock Constraints -- AssertWasCalled

Rhino Mock Constraints allow use to test a methods parameters were called with the correct arguments.

public interface IDocumentService
{
void Save(string userName, Document document, Stream stream);
}
 
 

Some ways to ensure the method that contains the save method passes the correct internally constructed arguments include
 
documentService.AssertWasCalled(
a=>a.Save("chris", doc, adaptor.InputStream),               
b => b.Constraints(Is.Equal(“chris”), Is.NotNull(), Is.AnyThing()));
 
 
Passing in Property.AllPropertiesMatch(this.MyTestObjectWithPropertiesThatShouldMatch)
will check values against each object
 


Posted by Chris on Thursday, May 20, 2010 5:55 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading