コード例 #1
0
        public void TestDefaultContextParentNestedIntCollectionEqualsNull()
        {
            using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
            {
                context.TraceProvider = new ConsoleTraceProvider();
                var skillWithIntArray = new SkillWithIntCollection {
                    BlahBlah = "test with no int array", Id = 3
                };

                context.AddUpdateDocument(skillWithIntArray, skillWithIntArray.Id);

                // Save to Elasticsearch
                var ret = context.SaveChanges();
                Assert.Equal(ret.Status, HttpStatusCode.OK);


                var returned = context.GetDocument <SkillWithIntCollection>(3);
                Assert.Equal(skillWithIntArray.BlahBlah, returned.BlahBlah);
                Assert.Null(returned.MyIntArray);
            }
        }
コード例 #2
0
        public void TestDefaultContextParentNestedIntCollection()
        {
            using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
            {
                context.TraceProvider = new ConsoleTraceProvider();
                var skillWithIntArray = new SkillWithIntCollection
                {
                    MyIntArray = new List <int> {
                        2, 4, 6, 99, 7
                    },
                    BlahBlah = "test3 with int array",
                    Id       = 2
                };
                context.AddUpdateDocument(skillWithIntArray, skillWithIntArray.Id);

                // Save to Elasticsearch
                var ret = context.SaveChanges();
                Assert.Equal(ret.Status, HttpStatusCode.OK);

                var returned = context.GetDocument <SkillWithIntCollection>(2);
                Assert.Equal(skillWithIntArray.MyIntArray[2], returned.MyIntArray[2]);
            }
        }
コード例 #3
0
        public void TestDefaultContextParentNestedIntCollectionEqualsNull()
        {
            using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
            {
                context.TraceProvider = new ConsoleTraceProvider();
                var skillWithIntArray = new SkillWithIntCollection { BlahBlah = "test with no int array", Id = 3 };

                context.AddUpdateDocument(skillWithIntArray, skillWithIntArray.Id);

                // Save to Elasticsearch
                var ret = context.SaveChanges();
                Assert.AreEqual(ret.Status, HttpStatusCode.OK);

                var returned = context.GetDocument<SkillWithIntCollection>(3);
                Assert.AreEqual(skillWithIntArray.BlahBlah, returned.BlahBlah, "Round Trip not the same");
                Assert.IsNull(returned.MyIntArray);
            }
        }
コード例 #4
0
        public void TestDefaultContextParentNestedIntCollection()
        {
            using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
            {
                context.TraceProvider = new ConsoleTraceProvider();
                var skillWithIntArray = new SkillWithIntCollection
                {
                    MyIntArray = new List<int> {2, 4, 6, 99, 7},
                    BlahBlah = "test3 with int array",
                    Id = 2
                };
                context.AddUpdateDocument(skillWithIntArray, skillWithIntArray.Id);

                // Save to Elasticsearch
                var ret = context.SaveChanges();
                Assert.AreEqual(ret.Status, HttpStatusCode.OK);

                var returned = context.GetDocument<SkillWithIntCollection>(2);
                Assert.AreEqual(skillWithIntArray.MyIntArray[2], returned.MyIntArray[2]);
            }
        }