C++ question on dependency injection and unit tests
Suppose I have a class BigClass that needs a member variable of type SmallClass

    class BigClass {
    .....
    private:
    SmallClass obj;
    };

I have 2 problems:


1) I cannot pass a SmallClass object to BigClass's constructor, since BigClass needs to process some files (and get some data) to properly instantiate SmallClass. I know that
the proper way to do dependency injection is to have a constructor `BigClass(SmallClass& obj)`. How do I solve this problem if SmallClass can be instantiated only after BigClass has 
lived for a while?

2) This is how BigClass constructs itself: it loops through files in a directory, reads some of the files to initialize its state. How can I make this unit testable ? What is a proper unit test for constructors that read files from directories to get state?
C++ question on dependency injection and unit tests
===

Suppose I have a class BigClass that needs a member variable of type SmallClass

    class BigClass {
    .....
    private:
    SmallClass obj;
    };

I have 2 problems:


1) I cannot pass a SmallClass object to BigClass's constructor, since BigClass needs to process some files (and get some data) to properly instantiate SmallClass. I know that
the proper way to do dependency injection is to have a constructor `BigClass(SmallClass& obj)`. How do I solve this problem if SmallClass can be instantiated only after BigClass has 
lived for a while?

2) This is how BigClass constructs itself: it loops through files in a directory, reads some of the files to initialize its state. How can I make this unit testable ? What is a proper unit test for constructors that read files from directories to get state?