Exemple #1
0
 public IHttpActionResult Post([FromBody] string s)
 {
     if (s == null)
     {
         return(BadRequest());
     }
     try
     {
         return(Ok(_cFAParseService.Calculator(s)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemple #2
0
 public void Test_CFAParseService_With_Fake_Input()
 {
     Assert.AreEqual(Mock_Correct_Answer[0], _CFAParseService.Calculator(Mock_Input[0]));
     Assert.AreEqual(Mock_Correct_Answer[1], _CFAParseService.Calculator(Mock_Input[1]));
     Assert.AreEqual(Mock_Correct_Answer[2], _CFAParseService.Calculator(Mock_Input[2]));
     Assert.AreEqual(Mock_Correct_Answer[3], _CFAParseService.Calculator(Mock_Input[3]));
     Assert.AreEqual(Mock_Correct_Answer[4], _CFAParseService.Calculator(Mock_Input[4]));
     Assert.AreEqual(Mock_Correct_Answer[5], _CFAParseService.Calculator(Mock_Input[5]));
     Assert.AreEqual(Mock_Correct_Answer[6], _CFAParseService.Calculator(Mock_Input[6]));
     Assert.AreEqual(Mock_Correct_Answer[7], _CFAParseService.Calculator(Mock_Input[7]));
     Assert.AreEqual(Mock_Correct_Answer[8], _CFAParseService.Calculator(Mock_Input[8]));
     //Wrong test
     //Assert.AreEqual(Mock_Wrong_Answer[0], _CFAParseService.Calculator(Mock_Input[0]));
     //Assert.AreEqual(Mock_Wrong_Answer[1], _CFAParseService.Calculator(Mock_Input[1]));
     //Assert.AreEqual(Mock_Wrong_Answer[2], _CFAParseService.Calculator(Mock_Input[2]));
     //Assert.AreEqual(Mock_Wrong_Answer[3], _CFAParseService.Calculator(Mock_Input[3]));
     //Assert.AreEqual(Mock_Wrong_Answer[4], _CFAParseService.Calculator(Mock_Input[4]));
     //Assert.AreEqual(Mock_Wrong_Answer[5], _CFAParseService.Calculator(Mock_Input[5]));
     //Assert.AreEqual(Mock_Wrong_Answer[6], _CFAParseService.Calculator(Mock_Input[6]));
     //Assert.AreEqual(Mock_Wrong_Answer[7], _CFAParseService.Calculator(Mock_Input[7]));
     //Assert.AreEqual(Mock_Wrong_Answer[8], _CFAParseService.Calculator(Mock_Input[8]));
 }