Chris McKelt

Remembering Thoughts

 

Recent comments

Archive

Authors

Categories

None


Disclaimer

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

© Copyright 2012

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 8:55 AM
Permalink | Comments (1) | Post RSSRSS comment feed

Comments (1) -

opieka informatyczna United States

Tuesday, October 26, 2010 12:29 PM

opieka informatyczna

Great blog, thanks a lot for the awesome posts!