I am getting some type errors that appear to have something to do with assembly identity. Here is the test code:
ICandidateScorer ifScorer =
InterfaceLoader.InstantiateInterface<ICandidateScorer>(sAlphaTraderAsy, sAlphaPredictorScorer);
Assert.IsInstanceOfType(ifScorer, typeof(AlphaPredictorScorer));
ifScorer.Initialize(sScorerFile);
AlphaPredictorScorer scorerAP = (AlphaPredictorScorer)ifScorer;
The Assert.IsInstanceOfType() is failing which the following message:
Assert.IsInstanceOfType failed.
Expected type:<Kent.AlphaTrader.AlphaPredictorScorer>.
Actual type:<Kent.AlphaTrader.AlphaPredictorScorer>.
The cast from ifScorer to scorerAP is failing with the following exception:
System.InvalidCastException :
[A]Kent.AlphaTrader.AlphaPredictorScorer cannot be cast to
[B]Kent.AlphaTrader.AlphaPredictorScorer.
Type A originates from 'AlphaTrader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' at location 'C:UserskentrDocumentsProjectsExcessionAlphaTrader.UnitTestinDebugAlphaTrader.dll'.
Type B originates from 'AlphaTrader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:UserskentrAppDataLocalTempTypemockExcessionTypemock.SmartRunner.Agent.exessemblydl34a603408e132_ad89d201AlphaTrader.dll'.
It appears the the Typemock test runner is modifying the original assembly such that .NET no longer recognizes the types that the code was originally compiled against.
Is there a way to deal with this?