|
From: <sco...@rk...> - 2005-06-07 12:17:50
|
Hello,
I just ran into this problem today. John, can you please post your patch =
and/or check it in. Thibaut, I am also interested to see what your work =
around is. Can you please post it?
Thanks,
-Scott
----Original Message-----
Hi Thibaut,
=20
This is actually the same problem I ran into that I mentioned in a =
recent list post (the
issue is "NMO-44" on the jira.truemesh tracker, but doesn"t seem to be =
in the sourceforge
tracker). I"ve got a fix for it that seems to work well, but it hasn"t =
been incorporated
into the official source yet.
=20
If you"re interested, I can send you the patch and you can compile your =
own version for the
time being.
=20
John.
=20
-----Original Message-----
From: nmock-general-admin@li...
[mailto:nmock-general-admin@li...] On Behalf Of Thibaut Barr=E8re
Sent: Tuesday, May 10, 2005 11:29 AM
To: <nmock-general@li...>
Subject: [Nmock-general] Inherited properties and DynamicMock (known =
bug?)
=20
Hi,
=20
I"m getting a NullReferenceException while calling SetupResult for an
inherited property (full testcase below) :
- is it a know issue ?
- which tracker should I use to open an issue for that, if not know =
already ?
=20
I found a quick workaround which is to create a custom class
inheriting from DynamicMock, and override Invoke().
=20
=20
regards
=20
Thibaut
=20
=20
=20
Repro:
=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
public enum MyEnum
{
MyValue
}
=20
public interface IMyInterface
{
MyEnum Enum { get; }
}
=20
public interface IMyChildInterface : IMyInterface
{
}
=20
[Test]
public void SetupResultWithInheritedProperty()
{
DynamicMock mock =3D new DynamicMock(typeof(IMyChildInterface));
mock.SetupResult("Enum",MyEnum.MyValue);
IMyChildInterface instance =3D (IMyChildInterface)mock.MockInstance;
}
=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
=20
Exception I get :
=20
System.NullReferenceException : Object reference not set to an
instance of an object.
at NMock.DynamicMock.checkReturnTypeIsValid(String methodName, Object
returnVal, MethodSignature signature)
at NMock.DynamicMock.SetupResult(String methodName, Object returnVal,
Type[] argTypes)
=20
=20
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_ids93&alloc_id=16281&op=3Dick
_______________________________________________
Nmock-general mailing list
Nmock-general@li...
https://lists.sourceforge.net/lists/listinfo/nmock-general
=20
From: <thibaut@gm...>
Re: Inherited properties and DynamicMock (known bug?) =20
2005-05-11 14:02
Hi John,
=20
thanks for pointing this out; I"ve missed the message.
=20
I can wait until it"s incorporated into the main tree, it"s just fine =
for me.
=20
Who are the committers ?
=20
=20
cheers
=20
Thibaut
=20
2005/5/11, John Price <John.Price@de...>:
> Hi Thibaut,
>=20
> This is actually the same problem I ran into that I mentioned in a =
recent list post (the
issue is "NMO-44" on the jira.truemesh tracker, but doesn"t seem to be =
in the sourceforge
tracker). I"ve got a fix for it that seems to work well, but it hasn"t =
been incorporated
into the official source yet.
>=20
> If you"re interested, I can send you the patch and you can compile =
your own version for
the time being.
>=20
> John.
>=20
> -----Original Message-----
> From: nmock-general-admin@li...
[mailto:nmock-general-admin@li...] On Behalf Of Thibaut Barr=E8re
> Sent: Tuesday, May 10, 2005 11:29 AM
> To: <nmock-general@li...>
> Subject: [Nmock-general] Inherited properties and DynamicMock (known =
bug?)
>=20
> Hi,
>=20
> I"m getting a NullReferenceException while calling SetupResult for an
> inherited property (full testcase below) :
> - is it a know issue ?
> - which tracker should I use to open an issue for that, if not know =
already ?
>=20
> I found a quick workaround which is to create a custom class
> inheriting from DynamicMock, and override Invoke().
>=20
> regards
>=20
> Thibaut
>=20
> Repro:
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> public enum MyEnum
> {
> MyValue
> }
>=20
> public interface IMyInterface
> {
> MyEnum Enum { get; }
> }
>=20
> public interface IMyChildInterface : IMyInterface
> {
> }
>=20
> [Test]
> public void SetupResultWithInheritedProperty()
> {
> DynamicMock mock =3D new =
DynamicMock(typeof(IMyChildInterface));
> mock.SetupResult("Enum",MyEnum.MyValue);
> IMyChildInterface instance =3D =
(IMyChildInterface)mock.MockInstance;
> }
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
>=20
> Exception I get :
>=20
> System.NullReferenceException : Object reference not set to an
> instance of an object.
> at NMock.DynamicMock.checkReturnTypeIsValid(String methodName, =
Object
> returnVal, MethodSignature signature)
> at NMock.DynamicMock.SetupResult(String methodName, Object =
returnVal,
> Type[] argTypes)
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_ids93&alloc_id=16281&op=3Dick
> _______________________________________________
> Nmock-general mailing list
> Nmock-general@li...
> https://lists.sourceforge.net/lists/listinfo/nmock-general
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_ids93&alloc_id=16281&opclick
> _______________________________________________
> Nmock-general mailing list
> Nmock-general@li...
> https://lists.sourceforge.net/lists/listinfo/nmock-general
>
|