title: How to debug or unit test DataProvider classes in dynamics AX 2012
body: <p>Is there any way to debug a DataProvider class, a class that extendes from SRSReportDataProviderBase, When my AOS, my client and my SQL are separated in different servers?</p>
  
  <p>Or there is any way to create a unit test or a job, that I could execute the DataProvider class? so I could debug it? // <strong><em>this question is solved below on the updated</em></strong></p>
  
  <p>I tryed to create a job so I that I can debug it, but of course their dependencies weren't injected.
  Here is the example:</p>
  
  <pre><code>          static void Job2(Args _args)
            {
             JmgEmplSignedInDP empl;
             ;
              empl = new JmgEmplSignedInDP();
              empl.processReport();
            }
  </code></pre>
  
  <p>And I got the following error, becuase it did not have their dependecies:</p>
  
  <pre><code> JmgEmplSignedInContract object not initialized.
   Stack trace
   (S)\Classes\JmgEmplSignedInDP\processReport - line 12
   (C)\Jobs\Job2 - line 8
  </code></pre>
  
  <p>There is any way to construct a DataProvider class so I can debug it??</p>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>I could inject the class dependecies, so now I can debug it. It's almost the same.
  But the initial question has not awnser yet:</p>
  
  <blockquote>
    <p>Is there any way to debug a DataProvider class, a class that extendes
    from SRSReportDataProviderBase, When my AOS, my client and my SQL are
    separated in different servers?</p>
  </blockquote>
  
  <p>Code to inject dependecies of a DataProvider Class:</p>
  
  <pre><code>    static void Job2(Args _args)
      {
          JmgEmplSignedInDP empl;
          JmgEmplSignedInContract con;
          Query q;
          ;
  
  
          empl = new JmgEmplSignedInDP();
          con = new JmgEmplSignedInContract();
          q = new Query(querystr(JmgEmplSignedInQuery));
          empl.parmQuery(q);
          empl.parmDataContract(con);
  
          empl.processReport();
  
      }
  </code></pre>