public void SetUp() { var cacheService = Substitute.For <ICacheService <FaqResponse <string> > >(); var qnaConfig = new QnaMakerConfiguration { KnowledgbaseBaseId = _knowledgbaseBaseId, OcpApimSubscriptionKey = _ocpApimSubscriptionKey }; _qnaMakerFaqService = new QnaMakerFaqService(qnaConfig, cacheService); }
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); }
public QnaMakerFaqService(QnaMakerConfiguration configuration, ICacheService <FaqResponse <string> > cacheService) { _httpClient = new HttpClient(); _configuration = configuration; _cacheService = cacheService; }