public IHttpActionResult GetQuestionOption() { ChatBotProcessor processor = new ChatBotProcessor(new DbDataAccessLayer()); try { QuestionOptionModel questionOption = processor.Process(0, null); if (questionOption == null) { return(NotFound()); } return(Ok(questionOption)); } catch (Exception ex) { return(Content(HttpStatusCode.BadRequest, ex.Message)); } }
public IHttpActionResult GetQuestionOption(int PreviousQuestion, string OptionSelected) { ChatBotProcessor processor = new ChatBotProcessor(new DbDataAccessLayer()); try { QuestionOptionModel questionOption = processor.Process(PreviousQuestion, OptionSelected); if (questionOption == null) { return(NotFound()); } return(Ok(questionOption)); } catch (Exception ex) { return(Content(HttpStatusCode.BadRequest, "Parameter entered are incorrect")); } }
public void Given_correct_parameters_when_process_invoked_then_nextQuestionOptionModel_expected() { ChatBotProcessor chatbot = new ChatBotProcessor(new FakeDataAccessLayerStub()); var QuestionOption = chatbot.Process(2, "true"); List <string> Options = new List <string>(); Options.Add("Telemetry"); Options.Add("MM cum PM"); Options.Add("EWS"); Options.Add("Spot Check PM"); Options.Add("Bedside"); Assert.AreEqual("Choose from the following CATEGORY options:", QuestionOption.Qusetion); for (int i = 0; i < QuestionOption.Options.Count; i++) { Assert.AreEqual(QuestionOption.Options[i], Options[i]); } }
public void Given_wrong_parameters_when_process_invoked_null_expected() { ChatBotProcessor chatbot = new ChatBotProcessor(new FakeDataAccessLayerStub()); var QuestionOption = chatbot.Process(100, "wrong"); }