Esempio n. 1
0
        public TestableDbProvider(string ksqlDbUrl, IHttpClientFactory httpClientFactory)
            : base(ksqlDbUrl)
        {
            this.httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));

            RegisterKSqlQueryGenerator = false;

            KSqlDBQueryContext.Configure(sc =>
            {
                sc.AddSingleton(httpClientFactory);
            });
        }
    public TestableDbProvider(string ksqlDbUrl, string httpResponse)
        : base(ksqlDbUrl)
    {
        RegisterKSqlQueryGenerator = false;

        KSqlDBQueryContext.Configure(sc =>
        {
            sc.AddHttpClient <IHttpV1ClientFactory, HttpClientFactory>(c => c.BaseAddress = new Uri(ksqlDbUrl))
            .AddHttpMessageHandler(_ => FakeHttpClient.CreateDelegatingHandler(httpResponse).Object);

            sc.AddHttpClient <IHttpClientFactory, HttpClientFactory>(c => c.BaseAddress = new Uri(ksqlDbUrl))
            .AddHttpMessageHandler(_ => FakeHttpClient.CreateDelegatingHandler(httpResponse).Object);

            // sc.AddSingleton(httpClientFactory);
        });
    }