I have a class A that has the following:
public class A { [Import(typeof(IMyService)] public IMyService MyService { get; set; } public A() { CompositionInitializer.SatisfyImports(this); } public void DoWork() {
And a test to verify this (a separate Dll - obviously)
[TestMethod] public void TestDoWork() {
This fails because trying to call "MyService" gives me a null value. I tried:
[ClassInitialize] public void InitialiseClass() { var myService = new Mock<IMyService>(); MyService = myService.Object; }
with 'MyService' declared as:
[Export(typeof(IMyService))] public IMyService MyService { get; set; }
But there is still no joy, I am missing something - is this possible?
I use SL3, MEF Preview 9 and MOQ.
Any help appreciated!
Greetings
Chris
c # moq silverlight mef
Chris skardon
source share