Esempio n. 1
0
        //private static void GetMonitorsBasedOnSpecs()
        //{
        //    Bot.PrintLine("These are the specifications which are available : ");
        //    string allDistinctSpecs = MonitorAccessor.GetDistinctSpecs();
        //    Bot.PrintData(allDistinctSpecs);
        //    string UserQuerySentence = Bot.Prompt("Please give me your specifications of the Monitor you are expecting");
        //    allDistinctSpecs = allDistinctSpecs.ToLower();
        //    string UserQuery = Logic.ExtractKeyword(allDistinctSpecs, UserQuerySentence);
        //    while (!(allDistinctSpecs.Contains(UserQuery)))
        //    {
        //        UserQuerySentence = Bot.Prompt("Sorry, No monitor is available for this specification.Please tell us any other specification.");
        //        if (UserQuerySentence.Contains("show") || UserQuerySentence.Contains("all") ||
        //            UserQuerySentence.Contains("what"))
        //        {
        //            Bot.PrintData(allDistinctSpecs);
        //            UserQuerySentence=Bot.Prompt("Here you go, These are all the different specifications that the monitors have. Please specify your need");
        //        }
        //        UserQuery = Logic.ExtractKeyword(allDistinctSpecs, UserQuerySentence);
        //    }
        //    Bot.PrintLine("Model Numbers with {0} as a specification are: ",UserQuery);
        //    string modelsOnSpecs = MonitorAccessor.GetModelOnSpecifications(UserQuery);
        //    Bot.PrintData(modelsOnSpecs);
        //    string modelNameSentence = Bot.Prompt("Select the model you want to inquire about");
        //    string modelName = Logic.ExtractKeyword(modelsOnSpecs, modelNameSentence).ToUpper();
        //    while (true)
        //    {
        //        while (!modelsOnSpecs.Contains(modelName))
        //        {
        //            modelNameSentence = Bot.Prompt(
        //                "The model you selected does not have {0} as a specification or is not available with us. Please enter the model name which has {0} as the specification",
        //                UserQuery);
        //            modelName = Logic.ExtractKeyword(modelsOnSpecs, modelNameSentence).ToUpper();
        //        }
        //        Bot.PrintData(MonitorAccessor.GetSpecification(modelName));
        //        string buyMonitor = Bot.Prompt("Do you want to select this product?");
        //        if (buyMonitor.Contains("yes"))
        //        {
        //            Cart.Monitors.Add(modelName);
        //            Bot.PrintLine("The product is successfully added to your cart.");
        //        }
        //        modelNameSentence = Bot.Prompt("Do you want the full specifications for more models? If Yes, Please specify the Model name.");
        //        if (modelNameSentence.Contains("what") || modelNameSentence.Contains("show"))
        //        {
        //            Bot.PrintData(modelsOnSpecs);
        //            modelNameSentence=Bot.Prompt("Here you go, These are the models of the specification '{0}'. Please choose one",UserQuery);
        //        }
        //        modelName = Logic.ExtractKeyword(modelsOnSpecs, modelNameSentence).ToUpper();
        //         if (modelNameSentence.Contains("no"))
        //         {
        //             return;
        //         }
        //    }
        //}

        private static void GetMonitorsBasedOnCategory()
        {
            Bot.PrintLine("Categories are mentioned below:");
            string allCategories = MonitorAccessor.GetSerialName();

            Bot.PrintData(allCategories);
            string categorySentence = Bot.Prompt("Select the Category you want to purchase?");
            string category         = Logic.ExtractKeyword(allCategories, categorySentence);

            while (!allCategories.Contains(category) && category.Contains(""))
            {
                categorySentence = Bot.Prompt("Sorry, This category is not available. Please enter the available categories with us.");
                category         = Logic.ExtractKeyword(allCategories, categorySentence);
            }
            Bot.PrintLine("Model Numbers of the category '{0}' are mentioned below:", category);
            string modelOnCategory = MonitorAccessor.GetModels(category);

            Bot.PrintData(modelOnCategory);
            string modelNameSentence = Bot.Prompt("Select the model you want to inquire about");
            string modelName         = Logic.ExtractKeyword(modelOnCategory, modelNameSentence).ToUpper();

            while (true)
            {
                while (!modelOnCategory.Contains(modelName))
                {
                    modelNameSentence = Bot.Prompt("The model you selected is not present in the '{0}' category. Please specify the model that is present in the selected category.", category);
                    modelName         = Logic.ExtractKeyword(modelOnCategory, modelNameSentence).ToUpper();
                }
                Bot.PrintData(MonitorAccessor.GetSpecification(modelName));
                string buyMonitor = Bot.Prompt("Do you want to select this product?");
                if (buyMonitor.Contains("yes"))
                {
                    cart.Monitors.Add(modelName);
                    Bot.PrintLine("The product is successfully added to your cart.");
                }
                modelNameSentence = Bot.Prompt("Do you want the full specifications for more models? If Yes, Please specify the Model name.");
                if (modelNameSentence.Contains("what") || modelNameSentence.Contains("show"))
                {
                    Bot.PrintData(modelOnCategory);
                    modelNameSentence = Bot.Prompt("Here you go, These are the models of category '{0}'.Please choose one", category);
                }
                modelName = Logic.ExtractKeyword(modelOnCategory, modelNameSentence).ToUpper();
                if (modelNameSentence.Contains("no"))
                {
                    return;
                }
            }
        }
        public void TestGetCategories()
        {
            string output = "bedside monitor\nhigh end monitors\nmaternity and fetal monitor\nvital signs monitor";

            Assert.AreEqual(output, MonitorAccessor.GetSerialName());
        }