public async Task AcceptRequestAsync_GetRequest_ReturnsHttpRequest() { // Arrange Target.Value.Start(); // Act var acceptRequestTask = Target.Value.AcceptRequestAsync(CancellationToken); var httpRequestTask = HttpClient.SendAsync(GetHttpRequestMessage, CancellationToken); var actual = await acceptRequestTask; // Assert actual.Method.ShouldBe("GET"); var httpListenerBasicIdentity = actual.User.Identity.ShouldBeOfType <HttpListenerBasicIdentity>(); httpListenerBasicIdentity.Name.ShouldBe(Identity.ToString()); httpListenerBasicIdentity.Password.ShouldBe(Password); actual.Uri.ShouldBe(RequestUri); actual.CorrelatorId.ShouldBe(EnvelopeId); actual.QueryString.ShouldNotBe(null); actual.QueryString.Get("value1").ShouldBe(QueryStringValue1); actual.QueryString.Get("value2").ShouldBe(QueryStringValue2.ToString()); }
public async Task AcceptRequestAsync_PostRequestNoId_ReturnsHttpRequestWithBody() { // Arrange Target.Value.Start(); // Act var acceptRequestTask = Target.Value.AcceptRequestAsync(CancellationToken); var httpRequestTask = HttpClient.SendAsync(PostHttpRequestMessage, CancellationToken); var actual = await acceptRequestTask; // Assert actual.Method.ShouldBe("POST"); var httpListenerBasicIdentity = actual.User.Identity.ShouldBeOfType <HttpListenerBasicIdentity>(); httpListenerBasicIdentity.Name.ShouldBe(Identity.ToString()); httpListenerBasicIdentity.Password.ShouldBe(Password); actual.Uri.ShouldBe(RequestUri); actual.CorrelatorId.ShouldNotBe(Guid.Empty); actual.QueryString.ShouldNotBe(null); actual.QueryString.Get("value1").ShouldBe(QueryStringValue1); actual.QueryString.Get("value2").ShouldBe(QueryStringValue2.ToString()); actual.ContentType.ShouldBe(RequestBodyMediaType); }