public void TestDefaultContextTestJsonIgnore() { using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver)) { context.TraceProvider = new ConsoleTraceProvider(); var testJsonIgnore = new TestJsonIgnore { MyStringArray = new List <string> { "ff", "dd" }, BlahBlah = "sss", Id = 3, MyLongArray = new List <long> { 23, 4323456, 333332 }, SkillSingleChildElement = new SkillSingleChildElement { Details = "ss", Id = 3 }, SkillSingleChildElementList = new List <SkillSingleChildElement> { new SkillSingleChildElement { Details = "ww", Id = 2 } } }; context.AddUpdateDocument(testJsonIgnore, testJsonIgnore.Id); // Save to Elasticsearch context.SaveChanges(); var ret = context.GetDocument <TestJsonIgnore>(3); Assert.AreEqual(ret.MyLongArray, null); Assert.AreEqual(ret.SkillSingleChildElement, null); Assert.AreEqual(ret.SkillSingleChildElementList, null); Assert.AreEqual(ret.BlahBlahNull, null); Assert.AreEqual(ret.BlahBlah, "sss"); Assert.AreEqual(ret.Id, 3); } }
public void TestDefaultContextTestJsonIgnore() { using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver)) { context.TraceProvider = new ConsoleTraceProvider(); var testJsonIgnore = new TestJsonIgnore { MyStringArray = new List<string> {"ff", "dd"}, BlahBlah = "sss", Id = 3, MyLongArray = new List<long> {23, 4323456, 333332}, SkillSingleChildElement = new SkillSingleChildElement {Details = "ss", Id = 3}, SkillSingleChildElementList = new List<SkillSingleChildElement> {new SkillSingleChildElement {Details = "ww", Id = 2}} }; context.AddUpdateDocument(testJsonIgnore, testJsonIgnore.Id); // Save to Elasticsearch context.SaveChanges(); var ret = context.GetDocument<TestJsonIgnore>(3); Assert.AreEqual(ret.MyLongArray, null); Assert.AreEqual(ret.SkillSingleChildElement, null); Assert.AreEqual(ret.SkillSingleChildElementList, null); Assert.AreEqual(ret.BlahBlahNull, null); Assert.AreEqual(ret.BlahBlah, "sss"); Assert.AreEqual(ret.Id, 3); } }