title: Mocking ExecutionContext in Azure queue trigger function unit tests
body: <p>How can I mock ExecutionContext when testing a queue trigger function? Below is the sample function where I am using ExecutionContext to getting some setting values which I use further down the function, I will need to provide testing values for these settings as well.</p>
  
  <pre><code>[FunctionName("ProcessQueueFunction")]
  public static void Run([QueueTrigger("process-queue", Connection = "AzureWebJobsStorage")]string queueItem, ILogger log, ExecutionContext context)
  {
     var config = new ConfigurationBuilder()
         .SetBasePath(context.FunctionAppDirectory)
         .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
         .AddEnvironmentVariables()
         .Build();
  
         var customConfiguraion = config.GetSection("CustomSection");
  
         //do stuff...
  }
  </code></pre>
  
  <p>I can do something link this but that gives me error on the FunctionAppDirectory being invalid or empty. What do I need to set FunctionAppDirectory to? or is this an incorrect way to do this?</p>
  
  <pre><code>var mockContext = new Mock&lt;ExecutionContext&gt;();
  mockContext.Object.FunctionAppDirectory = string.Empty; //or any other value
  
  ProcessQueueFunction.Run("TestQueueItem", log: logger, context: mockContext.Object);
  </code></pre>