public async Task GivenAFeedRequest_WithSessionConsistency_ThenTheResponseHeadersContainTheSessionToken()
        {
            _innerClient
            .ReadDatabaseFeedAsync(Arg.Is <FeedOptions>(o => o.ConsistencyLevel == ConsistencyLevel.Session && o.SessionToken == "1"))
            .Returns(new FeedResponse <Database>(Enumerable.Empty <Database>()));

            _requestHeaders.Add(CosmosDbHeaders.ConsistencyLevel, "Session");
            _requestHeaders.Add(CosmosDbHeaders.SessionToken, "1");

            await _fhirClient.ReadDatabaseFeedAsync();

            await _cosmosResponseProcessor.Received(1).ProcessResponse(Arg.Any <FeedResponse <Database> >());
        }
示例#2
0
        public async Task GivenAFeedRequest_WithSessionConsistency_ThenTheResponseHeadersContainTheSessionToken()
        {
            _innerClient
            .ReadDatabaseFeedAsync(Arg.Is <FeedOptions>(o => o.ConsistencyLevel == ConsistencyLevel.Session && o.SessionToken == "1"))
            .Returns(CreateFeedResponse(Enumerable.Empty <Database>(), new NameValueCollection {
                { CosmosDbHeaders.SessionToken, "2" }
            }));

            _requestHeaders.Add(CosmosDbHeaders.ConsistencyLevel, "Session");
            _requestHeaders.Add(CosmosDbHeaders.SessionToken, "1");

            await _fhirClient.ReadDatabaseFeedAsync();

            Assert.True(_responseHeaders.TryGetValue(CosmosDbHeaders.SessionToken, out var values));
            Assert.Equal("2", values.ToString());
        }