Ejemplo n.º 1
0
        public int Test1_AutoCheck(TestSerializerModel model)
        {
            //if( System.Web.HttpContext.Current.Request.ContentType.StartsWith("application/json") )
            //    model.DtValue = model.DtValue.ToLocalTime();

            string xml1 = model.ToString();
            string xml2 = s_lastTestSerializerModel.ToString();

            return(xml1 == xml2 ? 1 : 0);
        }
Ejemplo n.º 2
0
        public int Test2_AutoCheck(string stringVal, int intVal, DateTime dtValue, decimal money, Guid guid)
        {
            //if( System.Web.HttpContext.Current.Request.ContentType.StartsWith("application/json") )
            //    dtValue = dtValue.ToLocalTime();

            TestSerializerModel model = TestSerializerModel.Create(stringVal, intVal, dtValue, money, guid);

            string xml1 = model.ToString();
            string xml2 = s_lastTestSerializerModel.ToString();

            return(xml1 == xml2 ? 1 : 0);
        }
Ejemplo n.º 3
0
        private TestSerializerModel GetTestSerializerModel()
        {
            Random rand = new Random();

            s_lastTestSerializerModel = new TestSerializerModel {
                StringVal = "Fish Li",
                DtValue   = DateTime.Now,
                IntVal    = rand.Next(10, 100),
                Money     = Math.Round(1000M * (decimal)rand.NextDouble(), 4),
                Guid      = Guid.NewGuid()
            };
            return(s_lastTestSerializerModel);
        }
Ejemplo n.º 4
0
        public string Test2(string stringVal, int intVal, DateTime dtValue, decimal money, Guid guid)
        {
            TestSerializerModel model = TestSerializerModel.Create(stringVal, intVal, dtValue, money, guid);

            return(model.ToString());
        }
Ejemplo n.º 5
0
 public string Test1(TestSerializerModel model)
 {
     return(model.ToString());
 }
Ejemplo n.º 6
0
        public object GetJson()
        {
            TestSerializerModel model = GetTestSerializerModel();

            return(new JsonResult(model));
        }
Ejemplo n.º 7
0
        public object GetXml()
        {
            TestSerializerModel model = GetTestSerializerModel();

            return(new XmlResult(model));
        }