public void When_loading_objects_from_assembly_then_they_should_be_accessible() { var ctx = new CompositionContext(); ctx.AddPartsFromAssembly(GetType().GetTypeInfo().Assembly); var obj = new ImportClass2(); ctx.SatisfyImports(obj); Assert.IsTrue(obj.Object1 != null); }
public void When_adding_object_and_name_then_it_should_be_loadable() { var ctx = new CompositionContext(); var part1 = new ExportClass(); var part2 = new ExportClass(); ctx.AddPart <ExportClass, ExportClass>(part1, "1"); ctx.AddPart <ExportClass, ExportClass>(part2, "2"); var obj = new ImportClass2(); ctx.SatisfyImports(obj); Assert.AreEqual(part1, obj.Object1); Assert.AreEqual(part2, obj.Object2); }
public void When_loading_objects_from_assembly_then_they_should_be_accessible() { var ctx = new CompositionContext(); ctx.AddPartsFromAssembly(GetType().GetTypeInfo().Assembly); var obj = new ImportClass2(); ctx.SatisfyImports(obj); Assert.IsTrue(obj.Object1 != null); }
public void When_adding_object_and_name_then_it_should_be_loadable() { var ctx = new CompositionContext(); var part1 = new ExportClass(); var part2 = new ExportClass(); ctx.AddPart<ExportClass, ExportClass>(part1, "1"); ctx.AddPart<ExportClass, ExportClass>(part2, "2"); var obj = new ImportClass2(); ctx.SatisfyImports(obj); Assert.AreEqual(part1, obj.Object1); Assert.AreEqual(part2, obj.Object2); }