title: Dependency Injection - When to use property injection
body: <p>I've a class which have a constructor like this:</p>
  
  <pre><code>    private string _someString;
      private ObjectA _objectA;
      private ObjectB _objectB;
      private Dictionary&lt;Enum, long?&gt; _dictionaryA;
      private Dictionary&lt;Tuple&lt;Enum,long?&gt;, long?&gt; _dictionaryB; 
  
      public SomeDiClass(string someString)
      {
          _someString = someString;
  
          _objectA = new ObjectA();
          _objectB = new ObjectB();
  
          _dictionaryA = new Dictionary&lt;Enum, long?&gt;();
          _dictionaryB = new Dictionary&lt;Tuple&lt;Enum, long?&gt;, long?&gt;();
      }
  </code></pre>
  
  <p>I want to get the dependency creation out of this constructor. In a first step I would move the ObjectA and B dependency to the constructors parameters to inject them via constructor injection. I would like to use a IoC container for this purpose, that's where I stuck at the moment. The question is what to to with someString and the dictionaries. I need to inject them to the class, because the content of the dictionaries will be an important part of unit tests.
  Would it be a good idea to inject the string and the dictionaries via property injection (I don't need them in other classes), so I would end up with something like this?:</p>
  
  <pre><code>    private ObjectA _objectA;
      private ObjectB _objectB;
  
      public string SomeString { get; set; }
      public Dictionary&lt;Enum, long?&gt; DictionaryA { get; set; }
      public Dictionary&lt;Tuple&lt;Enum, long?&gt;, long?&gt; DictionaryB { get; set; }
  
      public SomeDiClass(ObjectA objectA, ObjectB objectB)
      {
          _objectA = objectA;
          _objectB = objectB;
      }
  </code></pre>
  
  <p>Is there a best practice to solve something like this?</p>