public IMatchProvider MatchProvider() { IMatchProvider matchStub = MockRepository.GenerateStub <IMatchProvider>(); // get all matches matchStub.Stub(x => x.GetAllLevel1()) .Return(matchProviderTestData.AllLevel1()); matchStub.Stub( x => x.GetAllLevel2()) .Return(matchProviderTestData.AllLevel2()); matchStub.Stub( x => x.GetAllLevel3()) .Return(matchProviderTestData.AllLevel3()); // single level1 match matchStub.Stub(x => x.GetMatches(Alternate[0])) .Return( matchProviderTestData.Level1Matches (Alternate[0])); // single level2 match matchStub.Stub( x => x.GetMatches( Alternate[1], Actual[0])) .Return( matchProviderTestData.Level2Matches( Actual[0], Alternate[1])); // single level3 match matchStub.Stub( x => x.GetMatches( Alternate[2], Actual[0], Actual[1])) .Return( matchProviderTestData.Level3Matches( Actual[0], Actual[1], Alternate[2])); // provide default empty lists if no records found // default empty list if no level 1 match matchStub.Stub(x => x.GetMatches(Arg <string> .Is.Anything)) .Return( matchProviderTestData.EmptyLevel1List()); // default empty list if no level 2 match matchStub.Stub( x => x.GetMatches( Arg <string> .Is.Anything, Arg <string> .Is.Anything)) .Return( matchProviderTestData.EmptyLevel2List()); // default empty list if no level3 match matchStub.Stub( x => x.GetMatches( Arg <string> .Is.Anything, Arg <string> .Is.Anything, Arg <string> .Is.Anything)) .Return( matchProviderTestData.EmptyLevel3List()); return(matchStub); }