Last active
March 20, 2023 00:42
-
-
Save TheFo2sh/bd10587eb1b39aa37fdf3cd129188753 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public async Task GeneratePdfCommandHandler_Should_Generate_Pdf() | |
{ | |
// Arrange | |
var htmlContent = "<html><body><h1>Test</h1></body></html>"; | |
var pdfGenerator = new Mock<IPdfGenerator>(); | |
pdfGenerator.Setup(x => x.GeneratePdfAsync(htmlContent)) | |
.ReturnsAsync(new byte[] { 0x25, 0x50, 0x44, 0x46 }); | |
var commandHandler = new GeneratePdfCommandHandler(pdfGenerator.Object); | |
var command = new GeneratePdfCommand { HtmlContent = htmlContent }; | |
// Act | |
await commandHandler.Handle(command); | |
// Assert | |
// Check that the PDF generator was called with the correct HTML content | |
pdfGenerator.Verify(x => x.GeneratePdfAsync(htmlContent), Times.Once); | |
// Check any other expected behavior | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment