Esempio n. 1
0
        public void debug_print_json_reader()
        {
            var objIn = new TestObject()
                {
                    Id = "MY_ID_HERE",
                    Name = "MY_NAME_HERE",
                    SomeNumber = 123,
                    Tags = new[] {"tag1", "tag2", "tag3"},
                    Children = new[]
                        {
                            new TestObject
                                {
                                    Name = "ArrayC1"
                                }
                        },
                    ChildrenList = new List<TestObject>
                        {
                            new TestObject() {Name = "ListC2"}
                        },
                    ChildrenIList = new List<TestObject>
                        {
                            new TestObject() {Name = "ListC3"}
                        }
                };

            var datum = DatumConvert.SerializeObject(objIn);

            Console.WriteLine(datum.ToDebugString());

            var objOut = DatumConvert.DeserializeObject<TestObject>(datum);

            objIn.ShouldBeEquivalentTo(objOut);
        }
Esempio n. 2
0
        public void debug_print_json_writer()
        {
            var testObject = new TestObject()
                {
                    Id = "MY_ID_HERE",
                    Name = "MY_NAME_HERE",
                    SomeNumber = 123,
                    Tags = new[] {"tag1", "tag2", "tag3"},
                    Children = new[]
                        {
                            new TestObject
                                {
                                    Name = "ArrayC1"
                                }
                        },
                    ChildrenList = new List<TestObject>
                        {
                            new TestObject() {Name = "ListC2"}
                        },
                    ChildrenIList = new List<TestObject>
                        {
                            new TestObject() {Name = "ListC3"}
                        }
                };

            var datum = DatumConvert.SerializeObject(testObject);
            Console.WriteLine(datum.ToDebugString());
        }
Esempio n. 3
0
        public TestObject TestObjectWithTestData()
        {
            var obj = new TestObject();
            obj.Id = "my_id_1234";
            obj.Name = "Brian Chavez";
            obj.SomeNumber = 1234.5;
            obj.Tags = new[] {"tag1", "tag2", "tag3"};

            obj.Children = new[]
                {
                    new TestObject
                        {
                            Name = "childrenArray1"
                        },
                    new TestObject
                        {
                            Name = "childrenArray2"
                        },
                    new TestObject
                        {
                            Name = "childrenArray3"
                        }
                };

            obj.ChildrenList = new List<TestObject>()
                {
                    new TestObject
                        {
                            Name = "childList1"
                        },
                    new TestObject
                        {
                            Name = "childList2"
                        },
                    new TestObject
                        {
                            Name = "childList3"
                        }
                };

            obj.ChildrenIList = new List<TestObject>()
                {
                    new TestObject
                        {
                            Name = "childrenIList1"
                        },
                    new TestObject
                        {
                            Name = "childrenIList2"
                        },
                    new TestObject
                        {
                            Name = "childrenIList3"
                        }
                };

            return obj;
        }
 private async Task DoInsert()
 {
     insertedObject = new TestObject()
     {
         Name = "Jim Brown",
         Children = new TestObject[] {
             new TestObject() { Name = "Scan" }
         },
         SomeNumber = 1234
     };
     var resp = await connection.RunAsync(testTable.Insert(insertedObject));
     insertedObject.Id = resp.GeneratedKeys[0];
 }
Esempio n. 5
0
 private async Task DoInsert()
 {
     var obj = new TestObject()
     {
         Name = "Jim Brown",
         Children = new TestObject[] {
             new TestObject() { Name = "Scan" }
         }
     };
     var resp = await connection.RunAsync(testTable.Insert(obj));
     Assert.That(resp, Is.Not.Null);
     Assert.That(resp.FirstError, Is.Null);
     Assert.That(resp.Inserted, Is.EqualTo(1));
     Assert.That(resp.GeneratedKeys, Is.Not.Null);
     Assert.That(resp.GeneratedKeys, Has.Length.EqualTo(1));
 }
Esempio n. 6
0
 private async Task DoInsert()
 {
     insertedObject = new TestObject()
     {
         Name = "Jim Brown",
         Children = new TestObject[] {
             new TestObject() { Name = "Scan" }
         },
         ChildrenList = new List<TestObject> {
             new TestObject() { Name = "Scan" }
         },
         ChildrenIList = new List<TestObject> {
             new TestObject() { Name = "Scan" }
         },
         SomeNumber = 1234,
         Data = new byte[] { 1, 2, 3, 4, 5 }
     };
     var resp = await connection.RunAsync(testTable.Insert(insertedObject));
     insertedObject.Id = resp.GeneratedKeys[0];
 }
Esempio n. 7
0
        public void debug_print_native_datum()
        {
            var testObject = new TestObject()
                {
                    Id = "MY_ID_HERE",
                    Name = "MY_NAME_HERE",
                    SomeNumber = 123,
                    Tags = new[] {"tag1", "tag2", "tag3"},
                    Children = new[]
                        {
                            new TestObject
                                {
                                    Name = "ArrayC1"
                                }
                        },
                    ChildrenList = new List<TestObject>
                        {
                            new TestObject() {Name = "ListC2"}
                        },
                    ChildrenIList = new List<TestObject>
                        {
                            new TestObject() {Name = "ListC3"}
                        }
                };


            var datum = Native.RootFactory.Get<TestObject>().ConvertObject(testObject);

            Console.WriteLine(datum.ToDebugString());
        }