Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created September 5, 2017 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/ada24b21092e641f8fa5803bcbb5ca39 to your computer and use it in GitHub Desktop.
Save justinyoo/ada24b21092e641f8fa5803bcbb5ca39 to your computer and use it in GitHub Desktop.
Make Your Azure WebJobs Testable Again
[TestClass]
public class ProgramTests
{
[TestMethod]
public void Given_JobHostBuilder_Main_ShouldReturn_Result()
{
var builder = new Mock<IJobHostBuilder>();
builder.SetupProperty(p => p.IsRunning);
// Inject a mocked instance to the property.
Program.WebJobHost = builder.Object;
Program.Main();
builder.Object.IsRunning.Should().BeTrue();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment