-
-
Save justinyoo/ada24b21092e641f8fa5803bcbb5ca39 to your computer and use it in GitHub Desktop.
Make Your Azure WebJobs Testable Again
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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