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

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

            return(sut.HttpContext.Response);
        }
        private async Task <HttpResponse> GetHttpResponseWithReconnectingStopped()
        {
            var context = FakeHttpContext.NewHttpContext();
            await HttpClient.StopReconnecting(context);

            return(context.Response);
        }
Example #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");
        }
Example #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");
        }
Example #6
0
 public async Task InitializeAsync()
 {
     _context = FakeHttpContext.NewHttpContext();
     _sut     = await HttpClient.NewClient(_context);
 }