public async Task GatewayAccountReader_MessageHandler() { HttpMessageHandler messageHandler = new CustomMessageHandler(); HttpClient staticHttpClient = new HttpClient(messageHandler); GatewayAccountReader accountReader = new GatewayAccountReader( serviceEndpoint: new Uri("https://localhost"), cosmosAuthorization: Mock.Of <AuthorizationTokenProvider>(), connectionPolicy: new ConnectionPolicy(), httpClient: MockCosmosUtil.CreateCosmosHttpClient(() => staticHttpClient)); DocumentClientException exception = await Assert.ThrowsExceptionAsync <DocumentClientException>(() => accountReader.InitializeReaderAsync()); Assert.AreEqual(HttpStatusCode.Conflict, exception.StatusCode); }
public async Task GatewayAccountReader_MessageHandler() { HttpMessageHandler messageHandler = new CustomMessageHandler(); HttpClient staticHttpClient = new HttpClient(messageHandler); GatewayAccountReader accountReader = new GatewayAccountReader( new Uri("https://localhost"), Mock.Of <IComputeHash>(), false, null, new ConnectionPolicy(), MockCosmosUtil.CreateCosmosHttpClient(() => staticHttpClient)); DocumentClientException exception = await Assert.ThrowsExceptionAsync <DocumentClientException>(() => accountReader.InitializeReaderAsync()); Assert.AreEqual(HttpStatusCode.Conflict, exception.StatusCode); }