IContainer fix

Added Method to have a Func as factory and fixed unit tests