Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created September 5, 2017 13:09
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