Integration Test Example With Rhino Mocks
- by guazz
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();