public void Test_ToMap() { TestRegModel model = new TestRegModel(); model.RequestId = "requestID"; model.Items = new List <TestRegSubModel> { new TestRegSubModel { RequestId = "sub" }, null }; model.NextMarker = "next"; model.testNoAttr = "noAttr"; model.subModel = new TestRegSubModel(); model.testListStr = new List <string> { "str" }; Dictionary <string, object> dic = model.ToMap(); Assert.NotNull(dic); Assert.IsType <List <object> >(dic["items"]); TestRegModel modelEmpty = new TestRegModel(); modelEmpty.RequestId = "1"; Dictionary <string, object> dicEmpty = modelEmpty.ToMap(); Assert.Null(dicEmpty["items"]); Assert.Null(dicEmpty["subModel"]); }