|
From: M. S. F. <va...@sc...> - 2007-05-14 14:47:57
|
Yeah. As I said in my blog, I think that this is a problem with the .Net framework, and not with NMock. Have you tried to see if you can reproduce the problem with Mono? Steve Mitcham wrote: > I copied your test case from your blog into the acceptance tests on my > version and the casting problem is still exhibited. > > -----Original Message----- > From: nmo...@li... > [mailto:nmo...@li...] On Behalf Of M. > Scott Ford > Sent: Monday, May 14, 2007 9:11 AM > To: NMock2 Development Discussion > Subject: Re: [NMock2-Dev] Fwd: [TDD] Nmock verify > > I wrote a few blog[1] posts[2] about this a long time ago. I am not sure > > if they are still relevant, but they may help. > > [1]: http://vaderpi.scottandlaurie.com/blog/?p=184 > [2]: http://vaderpi.scottandlaurie.com/blog/?p=188 > > Mike Capp wrote: > >> Hi Steve, >> >> I found your old mails on this subject while poking through the nmock >> list archives regarding a similar issue - an InvalidCastException on >> >> ArrayList list = new ArrayList(); >> list.Add(mockery.NewMock(typeof(IFoo))); >> IFoo[] array = (IFoo[]) list.ToArray(typeof(IFoo)); >> >> which I suspect has the same root cause as your IServiceContainer >> woes. Unfortunately, SourceForge's web archives don't include patches >> attached to mails (I only joined the project recently and so don't >> have the originals) and I didn't have your email until it popped up in >> this thread. Do you by any chance still have them handy? I'm not a >> project admin and so can't give you commit access, but I should be >> able to apply your fixes and check them in. >> >> cheers >> Mike >> >> >> On 04/05/07, Steve Mitcham <Ste...@ty...> wrote: >> >> >>> I've submitted a patch to a major issue that I've come up against, >>> > that > >>> I believe covers an open error in the bug list, several times only to >>> have the patch submission be completely ignored. I gave up sending >>> information to the lists a long time ago due to this behavior. I can >>> understand a patch being rejected, but I got no feedback whatsoever >>> > to > >>> my attempts. This occurred over the course of several months about a >>> year ago. The issue still exists. I don't have time to look up the >>> exact defect I'm talking about, however, the symptom of the problem >>> > I'm > >>> experiencing boils down to the following test: >>> >>> [Test] >>> public void MockObjectsCanBeContainedInServiceContainer() >>> { >>> Mockery mockery = new Mockery(); >>> ServiceContainer container = new ServiceContainer(); >>> IMockedType mockedType = mockery.NewMock(typeof >>> (IMockedType)) as IMockedType; >>> >>> container.AddService(typeof >>> > (IMockedType),mockedType); > >>> Assert.AreSame(mockedType,container.GetService(typeof(IMockedType))); >>> } >>> >>> I have a patch that my company uses that fixes this issue and also >>> allows for the following functionality: >>> >>> [Test] >>> public void EventsCanBeRaisedDuringTests() >>> { >>> m_listenerMessage = null; >>> Mockery mocks = new Mockery(); >>> Announcer announcer = (Announcer) >>> mocks.NewMock(typeof(Announcer)); >>> >>> >>> > Expect.Once.On(announcer).EventAdd("Listeners", > >>> new Listener(DummyListener)); >>> >>> announcer.Listeners += new >>> Listener(DummyListener); >>> >>> >>> > Fire.Event("Listeners").On(announcer).With("Test > >>> Message"); >>> >>> Assert.AreEqual("Test >>> Message",m_listenerMessage); >>> } >>> >>> >>> Finally, I have a patch to an issue raise several months ago >>> > concerning > >>> Verification of expectations when ordered expectations are used, also >>> > a > >>> major problem that remains unpatched to date as far as I can tell. >>> >>> >> > ------------------------------------------------------------------------ > - > >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> _______________________________________________ >> NMock-two-dev mailing list >> NMo...@li... >> https://lists.sourceforge.net/lists/listinfo/nmock-two-dev >> >> > > > > ------------------------------------------------------------------------ > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > NMock-two-dev mailing list > NMo...@li... > https://lists.sourceforge.net/lists/listinfo/nmock-two-dev > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > NMock-two-dev mailing list > NMo...@li... > https://lists.sourceforge.net/lists/listinfo/nmock-two-dev > |