Ejemplo n.º 1
0
        public async Task QnaMaker_ReturnsAnswer_Configuration()
        {
            var mockHttp = new MockHttpMessageHandler();

            mockHttp.When(HttpMethod.Post, GetRequestUrl())
            .Respond("application/json", GetResponse("QnaMaker_ReturnsAnswer.json"));

            var service = new QnAMakerService
            {
                KbId        = _knowlegeBaseId,
                EndpointKey = _endpointKey,
                Hostname    = _hostname
            };

            var options = new QnAMakerOptions
            {
                Top = 1
            };

            var client = new HttpClient(mockHttp);
            var qna    = new QnAMaker(service, options, client);

            var results = await qna.GetAnswersAsync(GetContext("how do I clean the stove?"));

            Assert.IsNotNull(results);
            Assert.AreEqual(results.Length, 1, "should get one result");
            StringAssert.StartsWith(results[0].Answer, "BaseCamp: You can use a damp rag to clean around the Power Pack");
        }
Ejemplo n.º 2
0
        private static IQnAService CreateQnAService(string subscriptionKey, string knowledgeBaseId, string defaultMessage = null, double scoreThreshhold = 0.3, int top = 1)
        {
            var         qnaAttribute = new QnAMakerAttribute(subscriptionKey, knowledgeBaseId, defaultMessage, scoreThreshhold, top);
            IQnAService qnAService   = new QnAMakerService(qnaAttribute);

            return(qnAService);
        }
Ejemplo n.º 3
0
        public async Task None(IDialogContext context, LuisResult result)
        {
            context.SendTypingAcitivity();

            var k = new QnAMakerService(new QnAMakerAttribute(WebConfigurationManager.AppSettings["QNAAuthKey"], WebConfigurationManager.AppSettings["QNAKnowledgeBaseId"], "Sorry Could not get that", .3, endpointHostName: WebConfigurationManager.AppSettings["QNAEndpointUrl"]));
            await context.Forward(new QnADialog(k), this.ResumeAfter, context.Activity, CancellationToken.None);
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,ServiceId,BaseAddress,Key,DisplayName,DisplayCategory")] QnAMakerService qnAMakerService)
        {
            if (id != qnAMakerService.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(qnAMakerService);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!QnAMakerServiceExists(qnAMakerService.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(qnAMakerService));
        }
        QnAMaker QnA(string EndpointKey, string KbId, string Hostname)
        {
            QnAMakerService Q = new QnAMakerService();

            Q.EndpointKey = EndpointKey;
            Q.KbId        = KbId;
            Q.Hostname    = Hostname;
            return(new QnAMaker(Q));
        }
Ejemplo n.º 6
0
        public async Task QnAs(IDialogContext context, LuisResult result)
        {
            var answers = await QnAMakerService.GenerateAnswer(result.Query);

            var answer = JObject.Parse(answers)["answers"][0]["answer"].ToString();
            await context.PostAsync(answer);

            context.Done <IArticle>(null); // 不返回文段
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HomeController"/> class.
 /// </summary>
 /// <param name="httpClient">Http client to be used.</param>
 /// <param name="tokenHelper">Token Helper.</param>
 /// <param name="kbInfoHelper">Knowledge base helper</param>
 /// <param name="graphHelper">Graph api helper</param>
 /// <param name="qnaMakerService">QnAMaker service</param>
 /// <param name="knowledgeBaseRefreshHelper"> Knowledge Base Refresh Helper </param>
 public HomeController(HttpClient httpClient, TokenHelper tokenHelper, KBInfoHelper kbInfoHelper, GraphHelper graphHelper, QnAMakerService qnaMakerService, KnowledgeBaseRefreshHelper knowledgeBaseRefreshHelper)
 {
     this.httpClient                 = httpClient;
     this.tokenHelper                = tokenHelper;
     this.kbInfoHelper               = kbInfoHelper;
     this.graphHelper                = graphHelper;
     this.qnaMakerService            = qnaMakerService;
     this.knowledgeBaseRefreshHelper = knowledgeBaseRefreshHelper;
 }
        public async Task Cumprimento(IDialogContext context, LuisResult result)
        {
            ConversationStarter.TextReference = string.Empty;
            await context.PostAsync($"Texto enviado: {result.Query}");

            var qnaService = new QnAMakerService(new QnAMakerAttribute(qnaSubscriptionKey, qnaKnowledgebaseId, "Buguei aqui, pera!  ¯\(º_o)/¯"));
            var qnaMaker   = new QnAMakerDialog(qnaService);
            await qnaMaker.MessageReceivedAsync(context, Awaitable.FromItem(activity));
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchController"/> class.
 /// </summary>
 /// <param name="jwtHelper">JWT Helper.</param>
 /// <param name="kbInfoHelper">KB helper to use</param>
 /// <param name="qnaMakerService">QnA Maker service to use</param>
 /// <param name="logProvider">Log provider to use</param>
 public SearchController(JwtHelper jwtHelper, KBInfoHelper kbInfoHelper, QnAMakerService qnaMakerService, ILogProvider logProvider)
 {
     this.jwtHelper              = jwtHelper;
     this.tenantId               = ConfigurationManager.AppSettings["TenantId"];
     this.kbInfoHelper           = kbInfoHelper;
     this.qnaMakerService        = qnaMakerService;
     this.logProvider            = logProvider;
     this.topResultsToBeFetched  = Convert.ToInt32(ConfigurationManager.AppSettings["TopResultCount"]);
     this.minimumConfidenceScore = Convert.ToInt32(ConfigurationManager.AppSettings["MinimumConfidenceScore"]);
 }
Ejemplo n.º 10
0
        public async Task <TextAndAudioWrapper> InputQuestionAndReturnAnswer(TextInput textInput)
        {
            var luisService = new LuisService();
            var wrapper     = new TextAndAudioWrapper();
            var question    = textInput.Text;

            var generalKB = new QnAMakerService(_qnaHostName,
                                                "d282ad63-9701-4548-afac-a421f0ec43ed", _endPointKey);

            var groupKB = new QnAMakerService(_qnaHostName,
                                              "b51f7e68-706b-42e4-8b31-0dd34d392a54", _endPointKey);

            var postKB = new QnAMakerService(_qnaHostName,
                                             "92e0fe0c-8826-4e60-8c47-9a4d36cb629e", _endPointKey);


            var intent = await luisService.GetIntent(question);

            string answer;

            switch (intent)
            {
            case "Group":
                answer = await groupKB.GetAnswer(question);

                break;

            case "Post":
                answer = await postKB.GetAnswer(question);

                break;

            case "None":
                answer = await generalKB.GetAnswer(question);

                break;

            default:
                answer = "Sorry, I don't know that.";
                break;
            }

            if (answer == "")
            {
                answer = "Sorry, I don't know that.";
            }

            var textToSpeechService = new TextToSpeechService();
            var audioAnswer         = await textToSpeechService.GenerateAudioSpeech(answer);

            wrapper.Text  = answer;
            wrapper.Audio = audioAnswer;
            return(wrapper);
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> Create([Bind("Id,ServiceId,BaseAddress,Key,DisplayName,DisplayCategory")] QnAMakerService qnAMakerService)
        {
            if (ModelState.IsValid)
            {
                _context.Add(qnAMakerService);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(qnAMakerService));
        }
Ejemplo n.º 12
0
        public async void AskForATopicTest()
        {
            var storage = new MemoryStorage();

            var userState         = new UserState(storage);
            var conversationState = new ConversationState(storage);

            var adapter = new TestAdapter()
                          .Use(new AutoSaveStateMiddleware(conversationState));

            var handler = new HttpClientHandler();

            handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true;
            var httpClient = new HttpClient(handler);

            // adding LUIS Router service
            LuisRouterService luisRouterService = new LuisRouterService(httpClient, Startup.EnvironmentName, Startup.ContentRootPath, userState, null);

            // adding QnAMaker service
            QnAMakerService qnaMakerService = new QnAMakerService(httpClient, Startup.EnvironmentName, Startup.ContentRootPath);

            var accessors = new BotAccessor(new LoggerFactory(), conversationState, userState)
            {
                ConversationDialogState   = conversationState.CreateProperty <DialogState>("DialogState"),
                AskForExamplePreference   = conversationState.CreateProperty <bool>("AskForExamplePreference"),
                IsAuthenticatedPreference = userState.CreateProperty <bool>("IsAuthenticatedPreference")
            };

            await new TestFlow(adapter, async(turnContext, cancellationToken) =>
            {
                var state   = await accessors.ConversationDialogState.GetAsync(turnContext, () => new DialogState());
                var dialogs = new DialogSet(accessors.ConversationDialogState);
                dialogs.Add(new LuisQnADialog(accessors, luisRouterService, qnaMakerService));

                var dc = await dialogs.CreateContextAsync(turnContext, cancellationToken);

                var results = await dc.ContinueDialogAsync(cancellationToken);
                if (results.Status == DialogTurnStatus.Empty)
                {
                    await dc.BeginDialogAsync(nameof(LuisQnADialog), null, cancellationToken);
                }
                else if (results.Status == DialogTurnStatus.Complete)
                {
                    //no additional send activities.
                }
            })
            .Send("")
            .AssertReply("What topic would you like to know more about?")
            .Send("what do i need to consider for an interview?")
            .AssertReply("In interviews, your job is to convince a recruiter that you have the skills, knowledge and experience for the job. Show motivation and convince a recruiter that you fit the organization's culture and job description, and you get that much closer to an offer.")
            .StartTestAsync();
        }
        private async Task QnaMakerMessage(IDialogContext context, string query)
        {
            var    qnaService = new QnAMakerService();
            string respuesta  = qnaService.GetAnswer(query);

            if (respuesta.Equals(QnAMakerConstantes.AnswerNotFound))
            {
                await context.PostAsync("Lo siento, no estoy preparado para este tipo de preguntas.");
            }
            else
            {
                await context.PostAsync(respuesta);
            }
        }
Ejemplo n.º 14
0
        private async Task QnaMakerMessage(IDialogContext context, string query)
        {
            var    qnaService = new QnAMakerService();
            string respuesta  = qnaService.GetAnswer(query);

            if (respuesta.Equals(QnaMakerConstants.AnswerNotFound))
            {
                await context.PostAsync("Lo siento pero no tengo una respuesta para esa pregunta.");
            }
            else
            {
                await context.PostAsync(respuesta);
            }
        }
Ejemplo n.º 15
0
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            var message         = await result as Activity;
            var serviceQnaMaker = new QnAMakerService();
            var respuesta       = serviceQnaMaker.GetAnswer(message.Text);

            if (respuesta.Equals(QnaMakerConstants.AnswerNotFound))
            {
                await context.PostAsync("Lo siento, pero no estoy preparado para este tipo de preguntas.");
            }
            else
            {
                await context.PostAsync(respuesta);
            }
        }
Ejemplo n.º 16
0
        public void QnaMakerSuffixTest()
        {
            var qnamaker = new QnAMakerService {
                Hostname = "http://foo.azurewebsites.net"
            };

            Assert.Equal("http://foo.azurewebsites.net/qnamaker", qnamaker.Hostname);

            qnamaker = new QnAMakerService {
                Hostname = "http://foo.azurewebsites.net/asdf?x=15"
            };
            Assert.Equal("http://foo.azurewebsites.net/qnamaker", qnamaker.Hostname);

            qnamaker = JsonConvert.DeserializeObject <QnAMakerService>("{\"hostname\":\"http://foo.azurewebsites.net/asdf?x=15\"}");
            Assert.Equal("http://foo.azurewebsites.net/qnamaker", qnamaker.Hostname);
        }
Ejemplo n.º 17
0
        public async void GetConfigurationTest()
        {
            // arrage
            HttpClient httpClient        = new HttpClient();
            var        storage           = new MemoryStorage();
            var        userState         = new UserState(storage);
            var        conversationState = new ConversationState(storage);
            var        adapter           = new TestAdapter().Use(new AutoSaveStateMiddleware(conversationState));
            var        dialogState       = conversationState.CreateProperty <DialogState>("dialogState");
            var        dialogs           = new DialogSet(dialogState);
            var        steps             = new WaterfallStep[]
            {
                async(step, cancellationToken) =>
                {
                    await step.Context.SendActivityAsync("response");

                    // act
                    IQnAMakerService qnAMakerService = new QnAMakerService(httpClient, EnvironmentName, ContentRootPath);
                    QnAMakerConfig   config          = qnAMakerService.GetConfiguration();

                    // assert
                    Assert.Equal(configuration.KbId, config.KbId);
                    Assert.Equal(configuration.Name, config.Name);
                    Assert.Equal(configuration.EndpointKey, config.EndpointKey);
                    Assert.Equal(configuration.Hostname, config.Hostname);

                    return(Dialog.EndOfTurn);
                }
            };

            dialogs.Add(new WaterfallDialog(
                            "test",
                            steps));

            await new TestFlow(adapter, async(turnContext, cancellationToken) =>
            {
                var dc = await dialogs.CreateContextAsync(turnContext, cancellationToken);
                await dc.ContinueDialogAsync(cancellationToken);
                if (!turnContext.Responded)
                {
                    await dc.BeginDialogAsync("test", null, cancellationToken);
                }
            })
            .Send("ask")
            .AssertReply("response")
            .StartTestAsync();
        }
Ejemplo n.º 18
0
        public static void Validate(this QnAMakerService qnaService)
        {
            if (string.IsNullOrWhiteSpace(qnaService.KbId))
            {
                throw new InvalidOperationException("The QnA KnowledgeBaseId ('kbId') is required to run this sample. Please update your 'appsettings.json' file.");
            }

            if (string.IsNullOrWhiteSpace(qnaService.EndpointKey))
            {
                throw new InvalidOperationException("The QnA EndpointKey ('endpointKey') is required to run this sample. Please update your 'appsettings.json' file.");
            }

            if (string.IsNullOrWhiteSpace(qnaService.Hostname))
            {
                throw new InvalidOperationException("The QnA Host ('hostname') is required to run this sample. Please update your 'appsettings.json' file.");
            }
        }
Ejemplo n.º 19
0
 /// <inheritdoc/>
 public QnAMaker GetQnAMaker(string knowledgeBaseId, string endpointKey)
 {
     return(this.qnaMakerInstances.GetOrAdd(knowledgeBaseId, (kbId) =>
     {
         var serviceConfig = new QnAMakerService
         {
             KbId = kbId,
             EndpointKey = endpointKey,
             Hostname = this.configuration["QnAMakerHostUrl"]
         };
         var options = new QnAMakerOptions
         {
             Top = 1,
             ScoreThreshold = float.Parse(this.configuration["ScoreThreshold"], CultureInfo.InvariantCulture),
         };
         return new QnAMaker(serviceConfig, options, this.httpClient);
     }));
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Creates Knowledge base
        /// </summary>
        /// <param name="kbName">Knowledge base name</param>
        /// <param name="qnAMakerService">QnAMaker service</param>
        /// <returns>Returns kbId</returns>
        private async Task <string> CreateEmptyKB(string kbName, QnAMakerService qnAMakerService)
        {
            string          kbId            = string.Empty;
            CreateKBRequest createKBRequest = new CreateKBRequest()
            {
                Name = kbName,
            };

            var qnaMakerResponse = await qnAMakerService.CreateKB(createKBRequest);

            var operationResponse = await qnAMakerService.AwaitOperationCompletionResponse(qnaMakerResponse);

            if (qnAMakerService.IsOperationSuccessful(operationResponse.OperationState))
            {
                kbId = operationResponse.ResourceLocation.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries)[1];
            }

            return(kbId);
        }
Ejemplo n.º 21
0
        public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (turnContext.Activity.Type == ActivityTypes.Message)
            {
                // Check LUIS model
                var recognizerResult = await _services.LuisServices[LuisKey].RecognizeAsync(turnContext, cancellationToken);
                var topIntent        = recognizerResult?.GetTopScoringIntent();
                var Itent            = topIntent.Value.intent;


                QnAMakerService qna = new QnAMakerService("https://luischatbotteste.azurewebsites.net", "3edfd898-ca35-444b-acc7-0d160c01fd1d", "fb4792a0-7297-4961-9c87-17db2a2b4e21");



                if (topIntent != null && topIntent.HasValue && topIntent.Value.intent != "None")
                {
                    var qnaMakerAnswer = await qna.GetAnswer(Itent);

                    await turnContext.SendActivityAsync(qnaMakerAnswer);

                    await turnContext.SendActivityAsync($"==>LUIS Top Scoring Intent: {topIntent.Value.intent}, Score: {ans.answer}\n");
                }
                else
                {
                    var msg = @"No LUIS intents were found.
                            This sample is about identifying two user intents:
                            'Calendar.Add'
                            'Calendar.Find'
                            Try typing 'Add Event' or 'Show me tomorrow'.";
                    await turnContext.SendActivityAsync(msg);
                }
            }
            else if (turnContext.Activity.Type == ActivityTypes.ConversationUpdate)
            {
                // Send a welcome message to the user and tell them what actions they may perform to use this bot
                await SendWelcomeMessageAsync(turnContext, cancellationToken);
            }
            else
            {
                await turnContext.SendActivityAsync($"{turnContext.Activity.Type} event detected", cancellationToken : cancellationToken);
            }
        }
Ejemplo n.º 22
0
    public BotConfig(IConfiguration config)
    {
        Padlock     = "";
        Name        = "AisBot";
        Description = "Generated bot file for emulator reference";

        CosmosStorage = new CosmosDbService();
        config.Bind("botSettings:cosmosDb", CosmosStorage);
        Services.Add(CosmosStorage);

        QnAMaker = new QnAMakerService();
        config.Bind("botSettings:qna", QnAMaker);
        Services.Add(QnAMaker);

        AppInsights = new AppInsightsService();
        config.Bind("botSettings:appInsights", AppInsights);
        Services.Add(AppInsights);

        Secret = config["botSettings:secret"];
    }
Ejemplo n.º 23
0
        /// <summary>
        /// Handles the users input and sends it to the QnA Maker database for handling
        /// </summary>
        /// <param name="context"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            var activity = await result as Activity;

            // We create a new QnAMaker service for handling the small talk. This is hard coded here for now
            // TODO Remove before publishing the source code publicly
            var smallTalkService = new QnAMakerService("", "", SupportBot.Models.ServiceRegion.WestUS, "Small Talk");

            try
            {
                // If the service returns and answer we post it to the conversation, we use a standard confidence of 0.0 to get an answer
                var answer = await smallTalkService.GenerateAnswerStringAsync(activity.Text);

                if (answer != null && answer != string.Empty && answer != "No good match found in the KB")
                {
                    await context.PostAsync(answer);
                }
                else
                {
                    // If we don't have an appropriate response we provide a default answer
                    await context.PostAsync(Resources.BotTexts.NoAnswerSmallTalk);
                }
            }
            catch (Exception e)
            {
                //TODO Remove
                await context.PostAsync(e.Message);

                // Tell the user if the QnA maker service is not available or any other problem occors
                await context.PostAsync(Resources.BotTexts.DatebaseNotAvailable);
            }
            finally
            {
                // End the dialog
                context.Done(String.Empty);
            }
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QnAMakerEndpoint"/> class.
 /// </summary>
 /// <param name="service">QnA service details from configuration.</param>
 public QnAMakerEndpoint(QnAMakerService service)
 {
     KnowledgeBaseId = service.KbId;
     EndpointKey     = service.EndpointKey;
     Host            = service.Hostname;
 }
Ejemplo n.º 25
0
 /// Initializes a new instance of the <see cref="QnAMaker"/> class.
 /// </summary>
 /// <param name="service">QnA service details from configuration.</param>
 /// <param name="options">The options for the QnA Maker knowledge base.</param>
 /// <param name="httpClient">An alternate client with which to talk to QnAMaker.
 /// If null, a default client is used for this instance.</param>
 public QnAMaker(QnAMakerService service, QnAMakerOptions options = null, HttpClient httpClient = null)
     : this(new QnAMakerEndpoint(service), options, httpClient, null)
 {
 }
Ejemplo n.º 26
0
 /// Initializes a new instance of the <see cref="QnAMaker"/> class.
 /// </summary>
 /// <param name="service">QnA service details from configuration.</param>
 /// <param name="options">The options for the QnA Maker knowledge base.</param>
 /// <param name="httpClient">An alternate client with which to talk to QnAMaker.
 /// If null, a default client is used for this instance.</param>
 /// <param name="telemetryClient">The IBotTelemetryClient used for logging telemetry events.</param>
 /// <param name="logPersonalInformation">Set to true to include personally indentifiable information in telemetry events.</param>
 public QnAMaker(QnAMakerService service, QnAMakerOptions options, HttpClient httpClient, IBotTelemetryClient telemetryClient, bool logPersonalInformation = false)
     : this(new QnAMakerEndpoint(service), options, httpClient, telemetryClient, logPersonalInformation)
 {
 }
Ejemplo n.º 27
0
 public async Task Apresentacao(IDialogContext context, LuisResult result)
 {
     var qnaService = new QnAMakerService(new QnAMakerAttribute(qnaSubscriptionKey, qnaKnowledgebaseId, "Buguei aqui, pera!  ¯\(º_o)/¯"));
     var qnaMaker   = new QnAMakerDialog(qnaService);
     await qnaMaker.MessageReceivedAsync(context, Awaitable.FromItem(ArgumentoStatic.Argument));
 }
 public QnaDialog(QnAMakerService qnaService) : base(qnaService)
 {
 }
Ejemplo n.º 29
0
 public static bool IsValid(this QnAMakerService qnaService)
 {
     return(!(string.IsNullOrWhiteSpace(qnaService.KbId) ||
              string.IsNullOrWhiteSpace(qnaService.EndpointKey) ||
              string.IsNullOrWhiteSpace(qnaService.Hostname)));
 }
Ejemplo n.º 30
0
        public void EncryptWithEmptyPropertiesOK()
        {
            // all of these objects should have null properties, this should not cause secret to blow up
            var secret = Guid.NewGuid().ToString("n");

            try
            {
                var generic = new GenericService();
                generic.Configuration["test"] = string.Empty;
                generic.Encrypt(secret);
                generic.Decrypt(secret);
            }
            catch (Exception)
            {
                Assert.Fail("generic failed with empty values");
            }

            try
            {
                var file = new FileService
                {
                    Path = string.Empty,
                };
                file.Encrypt(secret);
                file.Decrypt(secret);
            }
            catch (Exception)
            {
                Assert.Fail("file failed with empty values");
            }

            try
            {
                var luis = new LuisService
                {
                    SubscriptionKey = string.Empty,
                };
                luis.Encrypt(secret);
                luis.Decrypt(secret);
            }
            catch (Exception)
            {
                Assert.Fail("luis failed with empty values");
            }

            try
            {
                var dispatch = new DispatchService
                {
                    SubscriptionKey = string.Empty,
                };
                dispatch.Encrypt(secret);
                dispatch.Decrypt(secret);
            }
            catch (Exception)
            {
                Assert.Fail("dispatch failed with empty values");
            }

            try
            {
                var insights = new AppInsightsService
                {
                    InstrumentationKey = string.Empty,
                };
                insights.Encrypt(secret);
                insights.Decrypt(secret);
            }
            catch (Exception)
            {
                Assert.Fail("insights failed with empty values");
            }

            try
            {
                var bot = new BotService();
                bot.Encrypt(secret);
                bot.Decrypt(secret);
            }
            catch (Exception)
            {
                Assert.Fail("bot failed with empty values");
            }

            try
            {
                var cosmos = new CosmosDbService
                {
                    Key = string.Empty,
                };
                cosmos.Encrypt(secret);
                cosmos.Decrypt(secret);
            }
            catch (Exception)
            {
                Assert.Fail("cosmos failed with empty values");
            }

            try
            {
                var qna = new QnAMakerService
                {
                    SubscriptionKey = string.Empty,
                };
                qna.Encrypt(secret);
                qna.Decrypt(secret);
            }
            catch (Exception)
            {
                Assert.Fail("qna failed with empty values");
            }

            try
            {
                var blob = new BlobStorageService
                {
                    ConnectionString = string.Empty,
                };
                blob.Encrypt(secret);
                blob.Decrypt(secret);
            }
            catch (Exception)
            {
                Assert.Fail("blob failed with empty values");
            }

            try
            {
                var endpoint = new EndpointService
                {
                    AppPassword = string.Empty,
                };
                endpoint.Encrypt(secret);
                endpoint.Decrypt(secret);
            }
            catch (Exception)
            {
                Assert.Fail("endpoint failed with empty values");
            }
        }