public void BasicDIFactoryCreate() { DIFactory factory = new DIFactory(); factory.CreationMapping.Add(typeof(MyCreatingThing), (DIFactory f) => { return(new MyCreatingThing { Nuts = 88 }); }); Assert.IsTrue(factory.Create <MyCreatingThing>().Nuts == 88); factory.CreationMapping.Add(typeof(IThingy), (DIFactory f) => { return(new MyThingyImplemented()); }); Assert.IsTrue(factory.Create <IThingy>().GetAValue() == 123); MyAssert.ThrowsException(() => factory.Create <DIFactory>()); MyCreatingThing specialSetting = new MyCreatingThing { Nuts = 678 }; factory.SetSettingByType(specialSetting); Assert.IsTrue(factory.GetSettingByType <MyCreatingThing>().Nuts == 678); }