Change GenerateMock to StrictMock...still pass? On Fri, Oct 30, 2009 at 9:14 AM, Tarpan <[email protected]> wrote:
> > Yes, it is the same question. I just did not get any answers last > time, so I'm trying again. > > As for "you creating a stub rather than a mock", > Dim TestMock As ITestMock = MockRepository.GenerateMock(Of ITestMock) > () > does exactly the same. > > > > > On Oct 30, 9:59 am, Alex McMahon <[email protected]> wrote: > > Isn't this the same question you asked a little while ago? I think > > it's maybe to do with you creating a stub rather than a mock... as > > stubs aren't meant for asserting behaviour... (although I do recall a > > grey area where they can be used like this) > > > > 2009/10/30 Tarpan <[email protected]>: > > > > > > > > > Guys, Here is a simple test: > > > TestClass calls the TestMock twice and there is a > > > Assert...Repeat.Once. The test runs just fine. > > > I know I'm doing something wrong. But what? > > > > > ------------- > > > Imports MbUnit.Framework > > > Imports Rhino.Mocks > > > > > <TestFixture()> _ > > > Public Class AAA_test > > > <Test()> _ > > > Public Sub Test1() > > > Dim TestMock As ITestMock = MockRepository.GenerateStub(Of > > > ITestMock)() > > > Dim TestClass As CTestClass = New CTestClass > > > TestClass.test(TestMock) > > > TestMock.AssertWasCalled(Function(x) x.TestFunc, Function > > > (options) options.Repeat.Once) > > > End Sub > > > End Class > > > > > Public Class CTestClass > > > Public Sub test(ByVal TestMock As ITestMock) > > > TestMock.TestFunc() > > > TestMock.TestFunc() > > > End Sub > > > End Class > > > > > Public Interface ITestMock > > > Function TestFunc() As Object > > > End Interface > > > ---------------- > > > -- Tim Barcz Microsoft C# MVP Microsoft ASPInsider http://timbarcz.devlicio.us http://www.twitter.com/timbarcz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
