title: Best practice for Unit Testing class which is mostly responsible to call methods of dependencies, but contains logic as well
body: <p>Let's assume I have <code>StartCommandHandler</code> which has responsibility to create some file with required files. But for doing this I have to give him a set of sub-responsibilities, like:</p>
  
  <ul>
  <li>Checks whether file exists in the FTP</li>
  <li>If Not downloads files from multiple sources to the temp folder</li>
  <li>Then executes some script in the folder</li>
  <li>Then read generated file after script execution</li>
  <li>Then create zip from that folder</li>
  <li>Then remove that folder</li>
  <li>Then updates database</li>
  </ul>
  
  <p>As a result of that Command Handler, we are creating folder with all required files. And now that folder is ready for another operations.</p>
  
  <p>I have just read <code>"Art of the Unit testing"</code>. And started to add unit tests. I have followed <code>SOLID</code> principles as well. Especially, <code>SRP</code> and <code>DIP</code>, which are in my opinion prerequisites for Unit Testing.
  So, most of that things which I stated above are done with specific interfaces. So, 90% job of that Command Handler is to call methods of dependencies. And 10% is the logic like this:</p>
  
  <pre><code>if(!_dependency1.IsAnySomething())
  {
       _dependency2.Download();
  
        var isScriptNeeded = _dependency2.IsScriptNeeded();
  
        if(isScriptNeeded)
        {
            var res = _dependency3.ExecuteScript();
           _dependency4.SetScriptResult(res.Info, res.Date, res.State);
        }
  
       _dependency3.Archive();
  
       _dependency5.DeleteTemp();
  }
  </code></pre>
  
  <p>I already tested all dependencies of that command handler. But, hat command handler also includes some small logics like, is download file needed, or temp files are deleted or not and so on...</p>
  
  <p><strong><em>I have so many question in my mind like:</em></strong></p>
  
  <ol>
  <li>May be Unit Testing doesn't make sense for such units? Integration Test to the rescue? Because, it seems wrong to test whether to check all calls, like whether <code>DeleteTemp</code> is called after download, or script is executed or not, or <strong><em>script result is passed in a right way</em></strong> to <code>SetScriptResult</code> method. Is it GOOD Unit Test?</li>
  <li>Is there any way to refactor that class for making it testable?</li>
  </ol>