protected override MerchantShelfAddRequest InitRequestObject() { var request = new MerchantShelfAddRequest() { ShelfBanner = "http//img1.sh-bus.com/banner.jpg", ShelfName = "test shelf" }; var one = new ShelfModuleOne(50, 2); var two = new ShelfModuleTwo(new long[] { 49, 50, 51, 52 }); var three = new ShelfModuleThree(52, "http://img1.sh-bus.com/three.jpg"); var four = new ShelfModuleFour(new List <ShelfGroupInfo>() { new ShelfGroupInfo { GroupID = 49, Img = "http://img1.sh-bus.com/49.jpg" }, new ShelfGroupInfo { GroupID = 50, Img = "http://img1.sh-bus.com/50.jpg" } }); var five = new ShelfModuleFive(new long[] { 49, 50, 51, 52, 53 }, "http://img.sh-bus.com/backup.jpg"); request.AddModules(one, two, three, four); return(request); }
protected override string GetReturnResult(bool errResult) { if (errResult) { return(s_errmsg); } var one = new ShelfModuleOne(50, 2); var two = new ShelfModuleTwo(new long[] { 49, 50, 51, 52 }); var three = new ShelfModuleThree(52, "http://img1.sh-bus.com/three.jpg"); var four = new ShelfModuleFour(new List <ShelfGroupInfo>() { new ShelfGroupInfo { GroupID = 49, Img = "http://img1.sh-bus.com/49.jpg" }, new ShelfGroupInfo { GroupID = 50, Img = "http://img1.sh-bus.com/50.jpg" } }); var obj = new { errcode = 0, errmsg = "success", shelves = new List <ShelfInfo> { new ShelfInfo { Banner = "banner", Name = "shelf 1", ShelfID = 123, ShelfInfos = new ShelfModulesInfo { Modules = new List <ShelfModule> { new ShelfModuleFive( new long[] { 2000080093, 2000080094, 2000080095 }, "imgbackgournd.jpg" ) }, } }, new ShelfInfo { Banner = "banner 2", Name = "shelf 2", ShelfID = 234, ShelfInfos = new ShelfModulesInfo(new List <ShelfModule> { one, two, three, four }) } } }; var result = JsonSerialize(obj); Console.WriteLine(result); return(result); }
public void AddModules(ShelfModuleOne one, ShelfModuleTwo two, ShelfModuleThree three, ShelfModuleFour four) { Modules.Clear(); if (one != null) { Modules.Add(one); } if (two != null) { Modules.Add(two); } if (three != null) { Modules.Add(three); } if (four != null) { Modules.Add(four); } ShelfData = new ShelfModulesInfo(Modules); }