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
[Fact] | |
public async Task ShouldSubmitCorrectPayload() | |
{ | |
// ... Do all the set up required i.e. stubs, domain objects | |
// with pre-cooked data neccesary to execute the behaviour. | |
// Build the service/adapter object with this mock HttpMessageHandler | |
var loopbackHttpHandler = new SubmissionServiceHttpHandlerStub(); | |
var submitter = new SubmissionService( | |
new HttpClient(loopbackHttpHandler) | |
{ | |
BaseAddress = new Uri("http://foo.bar") | |
}); | |
var useCase = CreateUseCase(submitter); | |
useCase.Execute(...); | |
// verify that what will have been submitted to the external | |
// service would have been the right data | |
var payload = loopbackHttpHandler.PayloadDto("key"); | |
payload.Field1.Should().Be("abc"); | |
payload.Field2.Should().Be(10); | |
// other assertions | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment