Didn't Stefan already answer this: *why do you call Expect AND AssertWasCalled? Usually you**call - Exect and later VerfiyAllExpectations - OR Stub (if needed) and later AssertWasCalled*
On Wed, Oct 21, 2009 at 5:03 AM, Alex McMahon <[email protected]> wrote: > > I use AAA and have just checked and I've used Repeat.Once on an > AssertWasCalled and it works. The VB isn't really my forté so not sure > if it's because of VB? I've also checked and I've got examples where I > use the inline Arg constraints to specify Arg<bool>.Is.Anything and > Repeat.Once still works.... I can't see any examples where I've > combined IgnoreArguments with Repeat.Once, but that's cause I tend not > to use IgnoreArguments. > > Not sure if you've already done this but try removing all your > 'Expect' statements and stick to Stub and AssertWasCalled. > > 2009/10/20 Tarpan <[email protected]>: > > > > Anyone? > > Nobody use AAA syntax or what? > > Please help > > > > On Sep 24, 12:09 pm, Tarpan <[email protected]> wrote: > >> I saw the discussion on the stackoverflow.com and tried it. Still, > >> Repeat does not work in AssertWasCalled(). > >> > >> DPRepository.AssertWasCalled(Function(DPR) Check_Add(DPR), Function > >> (options) options.IgnoreArguments.Repeat.Once) > >> > >> Is it because of "IgnoreArguments"? > >> > >> Or because the functionality I check is a SUB not a function? So to > >> use it is AssertWasCalled I had to do : > >> > >> Private Function Check_Add(ByVal repository As > >> IDataProviderRepository) As Object > >> repository.AddDataProvider(Nothing) > >> Return Nothing > >> End Function > >> > >> Really I want to check that "AddDataProvider" was called specific > >> number of times. > >> > >> On Sep 18, 4:12 am, Stefan Steinegger <[email protected]> > >> wrote: > >> > >> > Repeat is an ongoing topic on Rhino, because it does not behave as > >> > expected, but this is by specification. > >> > >> > There is an explanation on stackoverflow: > http://stackoverflow.com/questions/887245/rhino-mocks-repeat-once-not... > >> > >> > by the way: why do you call Expect AND AssertWasCalled? Usually you > >> > call > >> > - Exect and later VerfiyAllExpectations > >> > - OR Stub (if needed) and later AssertWasCalled > >> > >> > On 16 Sep., 21:14, Tarpan <[email protected]> wrote: > >> > >> > > Hi, > >> > >> > > Does anybody know, is there any fix or workaround for "Repeat.Times > >> > > (x)" not working with AAA syntax in 3.5? > >> > >> > > Code (sorry for VB code - employer requirement): > >> > > --------------- > >> > > <Test()> _ > >> > > Public Sub DataProviderLoader_Test1() > >> > > DPRepository.Expect(Function(DPR) Check_Add > >> > > (DPR)).IgnoreArguments.Repeat.Once() > >> > > DataProviderLoader.CreateDataProviders(DataDictionary, > >> > > DPRepository, SqlRunner) > >> > > DPRepository.AssertWasCalled(Function(DPR) Check_Add(DPR), > >> > > Function(options) options.IgnoreArguments.Repeat.Once) > >> > > End Sub > >> > > --------------- > >> > >> > > 1st Line - DPRepository.Expect() - set expectation to be called > just > >> > > once > >> > > 3rd Line - DPRepository.AssertWasCalled() - verifies that the sub > was > >> > > called just once > >> > >> > > The sub called twice (guaranteed) and test completes just fine! > >> > >> > > Thanks for responses > >> > > Tarpan > >> > >> > > PS. I can not figure out how to use "Repeat" in 3.6. Can anybody > show > >> > > me an example? > > > > > > > > > -- Chris Missal http://chrismissal.lostechies.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en -~----------~----~----~----~------~----~------~--~---
