This is a mirror of official site: http://jasper-net.blogspot.com/

Untitled

| Monday, April 16, 2012
Various articals about Rhino Mock using and some techniques/tips etc...

Contents tagged with rhino-mocks

Today I learned that you can mock out and ref parameters with the following syntax in Rhino Mocks.

[TestMethod]
public void ShowHowRhinoMocksOutRefParameterWorks()
{
    /* Setup */
    var mock = MockRepository.GenerateMock<IBookRepository>();
    var bookFinder = new BookFinder(mock);
 
    /* Arrange */
    mock.Expect(rep => rep.FindByTitle(Arg<string>.Is.Anything, out Arg<int>.Out(10).Dummy))
        .Return(new List<Book>());
 
    /* Act */
    var count = 0;
    var books = bookFinder.FindBooks("hitchhikers guide to the galaxy", out count);
 
    /* Assert */
    Assert.AreEqual(10, count);
}

Read more: litemedia
QR: Inline image 1

Posted via email from Jasper-net

0 comments: