title: How to test the status of a an object at a specific state?
body: <p>I have a ReportHandler class, which can produce a report with 3 different statuses. </p>
  
  <ul>
  <li>InProgress, when the report is being generated (this could take from seconds to minutes)</li>
  <li>Success, when everything is OK</li>
  <li>Error, when something has gone wrong</li>
  </ul>
  
  <p>Inside the handler class, there is a mocked report generator, which setting it up accordingly, to return a report or throw an exception, I can test those scenarios. </p>
  
  <p>My problem is, that I need to write a test for the report which is in 'InProgress' status.</p>
  
  <pre><code>public async Task WriteReportAsync(SearchTermsRequestData requestData, string correlationId, CancellationToken cancellationToken)
      {
          WriteToFile(new Report { Status = ReportStatusType.InProgress.ToString() }, correlationId, _applicationSettings.OutputPath);
          var reportGenerator = _reportGeneratorFactory.GetReportGenerator(requestData);
  
          try
          {
              // reportGenerator is mocked in tests
              // once is mocked to return a report = success
              // once is mocked to throw exeption = error
              var report = await reportGenerator
                  .Generate(requestData);
              report.Status = ReportStatusType.Success.ToString();
              WriteToFile(report, correlationId, _applicationSettings.OutputPath);
          }
          catch (Exception exception)
          {
              WriteToFile(new Report { Status = ReportStatusType.Error.ToString(), Error = exception.Message }
                  , correlationId, _applicationSettings.OutputPath);
              _logger.Error(exception.Message);
          }
      }
  </code></pre>
  
  <p>How could i write a test, which can check the InProgress status which the report is written with as soon as the WriteReportAsync method is called?</p>
  
  <p>I have thought to write a moq with delay, but that delays the the overall execution and the assertions arent hit until the delay has passed, so that doesnt work.</p>