Example #1
0
 public string ComplexRowSet(TestComplexRow row)
 {
     row.ID               += 1;
     row.Row1.ID          += 2;
     row.ErrorRows[2].Date = row.ErrorRows[2].Date.AddDays(-2);
     return(row.ToJSON(JSONWritingOptions.CompactRowsAsMap));
 }
Example #2
0
        public void Action_ComplexRow(WebClient wc)
        {
            var initalRow = new TestComplexRow();

            initalRow.ID = 777;

            initalRow.Row1 = new TestRow()
            {
                ID = 101, Name = "Test Row 1", Date = DateTime.Now
            };
            initalRow.Row2 = new TestRow()
            {
                ID = 102, Name = "Test Row 2", Date = DateTime.Now
            };

            initalRow.ErrorRows = new TestRow[] {
                new TestRow()
                {
                    ID = 201, Name = "Err Row 1", Date = DateTime.Now
                },
                new TestRow()
                {
                    ID = 202, Name = "Err Row 2", Date = DateTime.Now
                },
                new TestRow()
                {
                    ID = 203, Name = "Err Row 3", Date = DateTime.Now
                }
            };

            var str = initalRow.ToJSON(JSONWritingOptions.CompactRowsAsMap);

            //using (var wc = CreateWebClient())
            {
                wc.Headers[HttpRequestHeader.ContentType] = NFX.Web.ContentType.JSON;
                var res = wc.UploadString(m_ServerURI + "ComplexRowSet", str);

                var map    = JSONReader.DeserializeDataObject(res) as JSONDataMap;
                var gotRow = JSONReader.ToRow <TestComplexRow>(map);

                if (initalRow.ID + 1 != gotRow.ID)
                {
                    throw new Exception();
                }
                if (initalRow.Row1.ID + 2 != gotRow.Row1.ID)
                {
                    throw new Exception();
                }
                if (gotRow.ErrorRows[2].Date - initalRow.ErrorRows[2].Date.AddDays(-2) >= TimeSpan.FromMilliseconds(1))
                {
                    throw new Exception();
                }
            }
        }
Example #3
0
        public void Action_ComplexRow(WebClient wc)
        {
            var initalRow = new TestComplexRow();

            initalRow.ID = 777;

            initalRow.Row1 = new TestRow(){ID = 101, Name = "Test Row 1", Date = DateTime.Now};
            initalRow.Row2 = new TestRow(){ID = 102, Name = "Test Row 2", Date = DateTime.Now};

            initalRow.ErrorRows = new TestRow[] {
              new TestRow() {ID = 201, Name = "Err Row 1", Date = DateTime.Now},
              new TestRow() {ID = 202, Name = "Err Row 2", Date = DateTime.Now},
              new TestRow() {ID = 203, Name = "Err Row 3", Date = DateTime.Now}
            };

            var str = initalRow.ToJSON(JSONWritingOptions.CompactRowsAsMap);

            //using (var wc = CreateWebClient())
            {
              wc.Headers[HttpRequestHeader.ContentType] = NFX.Web.ContentType.JSON;
              var res = wc.UploadString(m_ServerURI + "ComplexRowSet", str);

              var map = JSONReader.DeserializeDataObject(res) as JSONDataMap;
              var gotRow = JSONReader.ToRow<TestComplexRow>(map);

              if (initalRow.ID + 1 != gotRow.ID) throw new Exception();
              if (initalRow.Row1.ID + 2 != gotRow.Row1.ID) throw new Exception();
              if (gotRow.ErrorRows[2].Date - initalRow.ErrorRows[2].Date.AddDays(-2) >= TimeSpan.FromMilliseconds(1)) throw new Exception();
            }
        }
Example #4
0
 public string ComplexRowSet(TestComplexRow row)
 {
   row.ID += 1;
   row.Row1.ID += 2;
   row.ErrorRows[2].Date = row.ErrorRows[2].Date.AddDays(-2);
   return row.ToJSON(JSONWritingOptions.CompactRowsAsMap);
 }