Integration Test Example With Rhino Mocks

Posted by guazz on Stack Overflow See other posts from Stack Overflow or by guazz
Published on 2010-04-08T13:34:41Z Indexed on 2010/04/08 13:53 UTC
Read the original article Hit count: 401

Filed under:
|
|
|

I have two classes. I would like to verify that the properties are called on one of the classes.

public classA  
{  
    public IBInterface Foo {get;set;}  
    public LoadData()    
    {  
      Foo.Save(1.23456, 1.23456);  
    }  
}  

public classB : IBInterface   
{  
    public decimal ApplePrice {get; set;}    
    public decimal OrangePrice {get;  set;}    

    public void Save(decimal param1, decimal param2)  
    {  
        this.ApplePrice = param1;  
        this.OrangePrice = param2;  
    }
}  

I would like to use Rhino Mocks(AAA syntax) to verify that ApplePrice and OrangePrice were set correctly.

I assume I should begin like so but how do I verify that ApplePrice and OrangePrice have been set?

var mockInterfaceB = mockery.DynamicMock();
ClassA a = new ClassA();
a.Foo = mockInterfaceB;
a.LoadData();

© Stack Overflow or respective owner

Related posts about rhino

Related posts about mocks