tags:

views:

189

answers:

1

Hi,

I have a class 'Job' which takes 3 interfaces as paremters for depedency injection.

The first 2 interfaces live in the same assembly / class library as my Job class. The third interface lives in a seperate class library, part of the same solution and references by 'project'.

I'm trying to write a unit test using Job_Accessor so that I can check a private field...

However, I get a compile time error - Error 'Option Strict On disallows implicit conversions from 'DataEntities.IDataAccess' to 'DataEntities.IDataAccess'. It's complaining about the third parameter (the one that lives in the different class lib).

If I use just my Job class (instead of Job_Accessor) I do not get this error...

Is there an issue with the MS Test Project that when creating accessors, they only work acrross their own assembly? This error seems impossible to fix because it doesn't make any sense - it's complaining I can't cast a type to it's own type...

A: 

Answer has to do with the way assemblies are referenced, at least MS says. You have to play around with them and make sure they all use project type... evne then, this issue still creeps up now & again, and literally the only way to solve is to clean all, rebuild all, restart visual studio.. The issue doesn't happen with MSBUILD - so as we get to doing automated builds, this issue will be gone.

dferraro