コード例 #1
0
ファイル: SerializeTests.cs プロジェクト: harishjan/NEST
 public void ClassWithCollectionSerializes()
 {
     var col = new ClassWithCollections
     {
         Id = 2,
         ProductVariants = new List<SimpleClass>
         {
             new SimpleClass {Id = 1, Name = "class 1"},
             new SimpleClass {Id = 1, Name = "class 1"},
         }
     };
     var json = this._client.Serializer.Serialize(col);
     this.JsonEquals(json, MethodInfo.GetCurrentMethod());
 }
コード例 #2
0
        public void ManagedObjectClone_ClassWithCollections()
        {
            var src = new ClassWithCollections {
                IntList = new List <int> {
                    1, 5, 9
                }
            };
            var dst = new ManagedObjectClone().Clone(src) as ClassWithCollections;

            Assert.That(dst, Is.Not.Null);
            Assert.That(dst, Is.Not.SameAs(src));
            Assert.That(dst.IntList, Is.Not.SameAs(src.IntList));
            Assert.That(dst.IntList.Count, Is.EqualTo(src.IntList.Count));
            Assert.That(dst.IntList, Is.EquivalentTo(src.IntList));
        }
コード例 #3
0
ファイル: SerializeTests.cs プロジェクト: MaxHorstmann/NEST
        public void ClassWithCollectionSerializes()
        {
            var col = new ClassWithCollections
            {
                Id = 2,
                ProductVariants = new List <SimpleClass>
                {
                    new SimpleClass {
                        Id = 1, Name = "class 1"
                    },
                    new SimpleClass {
                        Id = 1, Name = "class 1"
                    },
                }
            };
            var json = this._client.Serializer.Serialize(col);

            this.JsonEquals(json, MethodInfo.GetCurrentMethod());
        }
コード例 #4
0
 public override void SetValue(ref ClassWithCollections container, Dictionary <HashSet <List <float> >, List <List <string> > > value)
 {
     container.Complex = value;
 }
コード例 #5
0
 public override Dictionary <HashSet <List <float> >, List <List <string> > > GetValue(ref ClassWithCollections container)
 {
     return(container.Complex);
 }
コード例 #6
0
 public override void SetValue(ref ClassWithCollections container, List <int> value)
 {
     container.Int32List = value;
 }
コード例 #7
0
 public override List <int> GetValue(ref ClassWithCollections container)
 {
     return(container.Int32List);
 }