コード例 #1
0
        public void SetUp()
        {
            var cacheService = Substitute.For <ICacheService <FaqResponse <string> > >();
            var qnaConfig    = new QnaMakerConfiguration
            {
                KnowledgbaseBaseId     = _knowledgbaseBaseId,
                OcpApimSubscriptionKey = _ocpApimSubscriptionKey
            };

            _qnaMakerFaqService = new QnaMakerFaqService(qnaConfig, cacheService);
        }
コード例 #2
0
 public void RegisterService(Type serviceType, object instance)
 {
     if (serviceType == typeof(Settings))
     {
         var settings  = instance as Settings;
         var qnaConfig = new QnaMakerConfiguration {
             KnowledgbaseBaseId = settings.QnaMaker.BaseId, OcpApimSubscriptionKey = settings.QnaMaker.Key
         };
         var cache = new SimpleMemoryCacheService <FaqResponse <string> >();
         RegisterSingleton <ICacheService <FaqResponse <string> > >(() => cache);
         RegisterSingleton <IFaqService <string> >(new QnaMakerFaqService(qnaConfig, cache));
     }
     RegisterSingleton(serviceType, instance);
 }
コード例 #3
0
 public QnaMakerFaqService(QnaMakerConfiguration configuration, ICacheService <FaqResponse <string> > cacheService)
 {
     _httpClient    = new HttpClient();
     _configuration = configuration;
     _cacheService  = cacheService;
 }