Exemplo n.º 1
0
        public async Task Should_Build_Expectation()
        {
            // Arrange
            var handler          = new MockHandler(_outputHelper);
            var mockServerClient = new MockServerClient(new HttpClient(handler));

            // Act
            await mockServerClient.SetupAsync(
                builder => builder
                .OnHandling(HttpMethod.Post, request => request.WithPath("some/path").EnableEncryption())
                .RespondWith(HttpStatusCode.Accepted, response => response.WithDelay(10, TimeUnit.Seconds))
                .Setup());

            // Assert
            handler.Expectations.Should().ContainSingle(
                e =>
                e.HttpRequest.Path == "/some/path" &&
                e.HttpRequest.Method == "POST" &&
                e.HttpRequest.Secure == true &&
                e.HttpResponse.Delay.Value == 10 &&
                e.HttpResponse.Delay.TimeUnit == TimeUnit.Seconds);
        }