public void ImportValueComComponent() { CTaskScheduler scheduler = new CTaskScheduler(); try { var container = ContainerFactory.Create(); var importer = new ImportComComponent(); CompositionBatch batch = new CompositionBatch(); batch.AddParts(importer); batch.AddExportedValue <ITaskScheduler>("TaskScheduler", (ITaskScheduler)scheduler); container.Compose(batch); Assert.Equal <object>(scheduler, importer.TaskScheduler); } finally { Marshal.ReleaseComObject(scheduler); } }
public void ImportValueComComponent() { CTaskScheduler scheduler = new CTaskScheduler(); try { var container = ContainerFactory.Create(); var importer = new ImportComComponent(); CompositionBatch batch = new CompositionBatch(); batch.AddParts(importer); batch.AddExportedValue<ITaskScheduler>("TaskScheduler", (ITaskScheduler)scheduler); container.Compose(batch); Assert.AreEqual(scheduler, importer.TaskScheduler); } finally { Marshal.ReleaseComObject(scheduler); } }