コード例 #1
0
        public async Task IfRequestDoesNotContainLastEventId_LastEventIdPropertyShouldBeNull()
        {
            var context = FakeHttpContext.NewHttpContext();
            var sut     = await HttpClient.NewClient(context);

            sut.LastEventId.Should().BeNull();
        }
コード例 #2
0
        private async Task <HttpResponse> GetHttpResponseOfNewClient()
        {
            var context = FakeHttpContext.NewHttpContext();
            var sut     = await HttpClient.NewClient(context);

            return(sut.HttpContext.Response);
        }
コード例 #3
0
        private async Task <HttpResponse> GetHttpResponseWithReconnectingStopped()
        {
            var context = FakeHttpContext.NewHttpContext();
            await HttpClient.StopReconnecting(context);

            return(context.Response);
        }
コード例 #4
0
        public async Task IfRequestContainsLastEventId_LastEventIdPropertyShouldBeSetToThisValue()
        {
            var context = FakeHttpContext.NewHttpContext();

            context.Request.Headers.Add("Last-Event-Id", "someId");

            var sut = await HttpClient.NewClient(context);

            sut.LastEventId.Should().Be("someId");
        }
コード例 #5
0
        public async Task IfHttpResponseHasAlreadyStarted_ShouldThrowArgumentException()
        {
            var context = FakeHttpContext.NewHttpContext();
            await context.Response.StartAsync();

            Func <Task> createClientAction = async() =>
                                             await HttpClient.NewClient(context);

            createClientAction.Should().Throw <ArgumentException>()
            .WithMessage("*Response * already started*",
                         because: "the header cannot be changed after the response has started");
        }
コード例 #6
0
 public async Task InitializeAsync()
 {
     _context = FakeHttpContext.NewHttpContext();
     _sut     = await HttpClient.NewClient(_context);
 }