public void SelectAllDataDateTime()
 {
     //Setup 
     var t = new DateTimeTranslator(UNIT_TEST_COL_NAME);
     var cmd = CreateTextCommand(SelectTestDataSQL());
     //Act
     var data = t.Translate(ExecuteDataTable(cmd));
     //Assert
     Assert.AreEqual(5, data.Count);
 }
        public void SelectAllDataDateTimeWithFilter()
        {
            //setup
            DateTime testvalue = DateTime.Now;
            var t = new DateTimeTranslator(UNIT_TEST_COL_NAME);
            var cmd = CreateTextCommand(SelectTestDataSQL(), "Where col >= @testValue");
            cmd.Parameters.Add(testvalue.ToSqlParameter("@testValue"));

            //Act
            var data = t.Translate(ExecuteDataTable(cmd));

            //Asert
            Assert.AreEqual(3, data.Count);
        }
Exemplo n.º 3
0
        public ActionResult AddSentence(SentenceViewModel model)
        {
            model.Entities = _analyzer.Analyze(model.Sentence);

            foreach (NerEntity ent in model.Entities)
            {
                DateTimeTranslator translator = new DateTimeTranslator();

                if (ent.Class == "@date")
                {
                    ent.Value = translator.Translate(ent.Value);
                }
            }

            return(View(model));
        }