title: How to unit tests a method that only does a foreach
body: <p>I have a simple method in my class that puts an element in the cache:</p>
  
  <pre><code>public void Put(TItem item)
  {
    // Do something
  }
  </code></pre>
  
  <p>Now I have added another method to be able to put multiple elements at once:</p>
  
  <pre><code>public void Put(IEnumerable&lt;TItem&gt; items)
  {
      foreach (var item in items)
      {
          Put(item);
      }
  }
  </code></pre>
  
  <p>It seems that to avoid duplication I should only check that I call Put a number of times. But I can do this only indirectly as this is not a dependency. Is there a way to avoid copy/paste when testing these kind of methods? I can do a smoke test to check some outcomes of the Put, but it has a lot of unit tests on its own and they won't be complete in this case. Is there any good way out of the situation?</p>