static void Main(string[] args) { var program = new Program(); MEF.Import(program); Console.WriteLine(MEF.Container); Console.WriteLine(Impl.MEFPart.Container); Console.WriteLine(program.s); Console.WriteLine(program.s == MyClass.test); // Console.WriteLine(s == MyClass.test); }
public void 实例对象导入插件组() { Assert.IsNull(s); Assert.IsNull(s1); Assert.IsNull(s2); //Assert.AreEqual(null, s3); Assert.IsNull(s4); MEF.Import(this); Action <IEnumerable <string> > assert = p => { Assert.AreEqual(3, p.Count()); Assert.IsTrue(p.Contains("2")); Assert.IsTrue(p.Contains("1")); Assert.IsTrue(p.Contains(MyClass.test)); }; assert(s); assert(s1); assert(s2); //assert(s3); assert(s4); }
public void 静态对象导入插件组() { Assert.IsNull(ss); Assert.IsNull(ss1); Assert.IsNull(ss2); Assert.IsNull(ss3); Assert.IsNull(ss4); MEF.Import(typeof(UnitTest4)); Action <IEnumerable <string> > assert = p => { Assert.IsNotNull(p); Assert.AreEqual(3, p.Count()); Assert.IsTrue(p.Contains("2")); Assert.IsTrue(p.Contains("1")); Assert.IsTrue(p.Contains(MyClass.test)); }; assert(ss); assert(ss1); assert(ss2); assert(ss3); assert(ss4); }
public void 实例静态导入类型实现() { Assert.IsNull(s1); MEF.Import(typeof(UnitTest5)); Assert.AreEqual("UnitTest5", s1?.Clone()); }
public void 实例字段导入类型实现() { Assert.IsNull(s0); MEF.Import(this); Assert.AreEqual("UnitTest5", s0?.Clone()); }
public void 静态对象导入插件() { Assert.AreEqual(null, ss); MEF.Import(typeof(UnitTest3)); Assert.AreEqual(MyClass.test, ss); }
public void 实例对象导入插件() { Assert.AreEqual(null, s); MEF.Import(this); Assert.AreEqual(MyClass.test, s); }