Night Walker
Night Walker

Reputation: 21260

How to save arguments of function call in Rhino Mocks?

    MockRepository mocks = new Rhino.Mocks.MockRepository();  
    IActiveProgram  repository = mocks.CreateMock<IActiveProgram>();  


    var readPrg = new ReadProgram();
    readPrg.init("333", "eee", "", null, repository);

In readPrg.init I will have a several calls on repository object. For example repository.AddProgram(programName);

How I will be able to know later on exit from readPrg.init to know the arguments that my prerecorded function calls been executed.

Thanks for help.

Upvotes: 0

Views: 304

Answers (1)

Amittai Shapira
Amittai Shapira

Reputation: 3827

You'd call repository.AssertWasCalled(x => x.AddProgram(programName)) after you call init. Look also in the original post of Rhino Mocks AAA syntax
Another option, you could use Expect:

repository.Expect(x => x.AddProgram(programName)).Repeat.Times(50)
var readPrg = new ReadProgram();
readPrg.init("333", "eee", "", null, repository);
repository.VerifyAllExpectations()

Upvotes: 1

Related Questions