/// <summary> /// Generate the necessary parameters /// </summary> public List <KeyValuePair <string, string> > GetParams() { var p = new List <KeyValuePair <string, string> >(); if (CountryCode != null) { p.Add(new KeyValuePair <string, string>("CountryCode", CountryCode)); } if (Type != null) { p.AddRange(Type.Select(prop => new KeyValuePair <string, string>("Type", prop))); } if (AddOns != null) { p.AddRange(AddOns.Select(prop => new KeyValuePair <string, string>("AddOns", prop))); } if (AddOnsData != null) { p.AddRange(PrefixedCollapsibleMap.Serialize(AddOnsData, "AddOns")); } return(p); }
public void TestNormalSerialize() { var inputDict = new Dictionary <string, object> { { "foo", "bar" }, { "super", new Dictionary <string, object> { { "cool", "people" }, { "fun", "times" } } } }; var result = PrefixedCollapsibleMap.Serialize( inputDict, "really" ); var expected = new Dictionary <string, string> { { "really.foo", "bar" }, { "really.super.cool", "people" }, { "really.super.fun", "times" } }; CollectionAssert.AreEquivalent(expected, result); }
public void TestNullSerialize() { var result = PrefixedCollapsibleMap.Serialize(null, "really"); CollectionAssert.AreEquivalent(new Dictionary <string, string>(), result); }