Thanks folks.
Please, let me know when I can download a fixed version (both this  
and CopyTo issue)
Thanks, again.

P.S.
BTW, Jeff has mentioned that Gallio is going to have an automatic  
updater. Do you plan to release it soon?

On 29/08/2009, at 23:12, Jeff Brown wrote:

>
> I think this is a bug.
>
> Yann, the bug is on line 124 of VerifyContractAttribute.cs:
>
> FieldInfo fieldInfo = field.Resolve(true);
> IContract contract = fieldInfo.GetValue(fieldInfo.IsStatic ? null :
> state.FixtureInstance) as IContract;
>
> The problem is that 'field' is going to be a reference to a field of a
> generic type definition.  We can't use that reference to get the  
> value of a
> field defined on a specialization of that generic type.
>
> We should use the FixtureMemberInvoker here like we do in  
> FactoryAttribute.
>
> It might be good to check DynamicTestFactoryAttribute too.
>
> Jeff.
>
> -----Original Message-----
> From: [email protected]  
> [mailto:[email protected]] On
> Behalf Of Mark Kharitonov
> Sent: Saturday, August 29, 2009 4:19 AM
> To: MbUnit.User
> Subject: MbUnit Do contract verifiers work inside generic test  
> fixtures?
>
>
> Hi, examine the following trivial sample:
> =========================================================
> namespace ListContractTest
> {
>   internal static class TypeFactory
>   {
>     internal static IEnumerable<Type> GetTypes()
>     {
>       yield return typeof(int);
>     }
>   }
>
>   [TestFixture]
>   public class ListContractTest<[Factory(typeof(TypeFactory),
> "GetTypes")] T>
>   {
>     [VerifyContract]
>     public readonly IContract CollectionTests = new
> ListContract<ReadOnlyCollection<int>, int>
>     {
>       IsReadOnly = true,
>       DefaultInstance = () => new ReadOnlyCollection<int>(new[]  
> { 0, 5, 7, 2
> }),
>       DistinctInstances = new DistinctInstanceCollection<int>(new[]
> { 5, 10 }),
>     };
>   }
> }
> =========================================================
>
> Trying to run the fixture yields the following error message:
> System.InvalidOperationException: Late bound operations cannot be  
> performed
> on fields with types for which Type.ContainsGenericParameters is true.
>    at System.Reflection.RtFieldInfo.GetValue(Object obj)
>
> Is it by design?
>
>
> >

======================================================================== 
==
There are two kinds of people. Those whose guns are loaded and those  
who dig.
                                                                                
                                (The good, the bad and the ugly).
So let us raise our cups for our guns always be loaded.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" 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/mbunituser?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to