public ActionResult GetWatchLists(int fromDate, int toDate)
 {
     try
     {
         WatchListsBusiness watchListsBusiness = new WatchListsBusiness();
         List <WatchList>   watchLists         = watchListsBusiness.GetWatchlists(fromDate, toDate);
         var jsonObject = new
         {
             code = 1,
             len  = watchLists.Count,
             data = watchLists
         };
         return(Json(jsonObject));
     }
     catch (Exception e)
     {
         var jsonObject = new
         {
             code = 0,
             len  = 0,
             data = new List <WatchList>()
         };
         return(Json(jsonObject));
     }
 }
示例#2
0
        public void TestGetWatchLists()
        {
            int fromDate = 20160104, toDate = 20160328;
            WatchListsBusiness watchListsBusiness = new WatchListsBusiness();

            try
            {
                List <WatchList> watchLists = watchListsBusiness.GetWatchlists(fromDate, toDate);
                Assert.IsTrue(watchLists.Count > 0);
            }
            catch (Exception ex)
            {
                //Assert.IsInstanceOfType(ex, typeof(DemoException));
            }
        }