|
From: Mike C. <mik...@gm...> - 2007-05-14 14:02:06
|
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.
|