/// <summary> /// Creates a nested dictionary from an ienumerable according to a specified key selectors function, comparers, and an element selector function. /// </summary> /// <typeparam name="TSource">The type of the elements of source.</typeparam> /// <typeparam name="TKey1">The type of the key returned by key1Selector for level 1.</typeparam> /// <typeparam name="TKey2">The type of the key returned by key2Selector for level 2.</typeparam> /// <typeparam name="TElement">The type of the value returned by elementSelector.</typeparam> /// <param name="source">An ienumerable to create a nested dictionary from.</param> /// <param name="key1Selector">A function to extract a key for level 1 from each element.</param> /// <param name="key2Selector">A function to extract a key for level 2 from each element.</param> /// <param name="elementSelector">A transform function to produce a result element value from each element.</param> /// <param name="comparer1">An comparer to compare keys on level 1.</param> /// <param name="comparer2">An comparer to compare keys on level 2.</param> /// <returns>A nested dictionary that contains values of type TElement selected from the input sequence.</returns> /// <exception cref="ArgumentNullException">source or some of keySelectors or elementSelector is null.-or- some of keySelectors produces a key that is null.</exception> /// <exception cref="ArgumentException">Some of keySelectors produces duplicate keys for two elements.</exception> public static NestedDictionary <TKey1, TKey2, TElement> ToNestedDictionary <TSource, TKey1, TKey2, TElement>(this IEnumerable <TSource> source, Func <TSource, TKey1> key1Selector, Func <TSource, TKey2> key2Selector, Func <TSource, TElement> elementSelector, IEqualityComparer <TKey1> comparer1, IEqualityComparer <TKey2> comparer2) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (key1Selector == null) { throw new ArgumentNullException(nameof(key1Selector)); } if (key2Selector == null) { throw new ArgumentNullException(nameof(key2Selector)); } if (elementSelector == null) { throw new ArgumentNullException(nameof(elementSelector)); } NestedDictionary <TKey1, TKey2, TElement> dictionary = new NestedDictionary <TKey1, TKey2, TElement>(comparer1, comparer2); foreach (TSource element in source) { dictionary.Add(key1Selector(element), key2Selector(element), elementSelector(element)); } return(dictionary); }
public StoneMountSuccess(long TR, byte SeqNum, int ItemNum, int StoneNum, NestedDictionary <byte, byte, int, List <ItemAttr> > infos, byte last) { /*FF 8D 05 01 00 00 00 00 00 00 00 5F 73 6A 03 * 00 00 00 00 03 77 E5 00 00 01 03 09 0D D2 00 * 00 02 02 00 CD CC 4C 3D 7B 17 00 00 40 40 80*/ ns.Write((byte)0xFF); ns.Write((short)0x58D); ns.Write(1);//err ns.Write(0); ns.Write(TR); ns.Write(SeqNum); ns.Write(ItemNum); ns.Write((byte)infos.Count); foreach (var i in infos) { ns.Write(i.Key); //SeqNum foreach (var j in i.Value) { ns.Write(j.Key); //SocketNum foreach (var k in j.Value) { ns.Write(k.Key); //StoneNum ns.Write((byte)k.Value.Count(c => c.AttrValue > 0)); //attr count foreach (var x in k.Value.Where(c => c.AttrValue > 0)) { ns.Write(x.Attr); //attr 6011 = point ns.Write(x.AttrValue); } } } } ns.Write(last); }
public HttpResponse Object(NestedDictionary obj) { var finalObj = new ConvertObject(); finalObj.Assign(obj); return(SendJson(new { obj = finalObj })); }
public static IEnumerable <object[]> InvalidDictionaries() { yield return(new object[] { NestedDictionary <string> .WithInvalidChild("key1"), "key1" }); yield return(new object[] { NestedDictionary <int> .WithInvalidChild(-1), "-1" }); yield return(new object[] { NestedDictionary <uint> .WithInvalidChild(1), "1" }); yield return(new object[] { NestedDictionary <short> .WithInvalidChild(-2), "-2" }); yield return(new object[] { NestedDictionary <ushort> .WithInvalidChild(2), "2" }); yield return(new object[] { NestedDictionary <long> .WithInvalidChild(-3), "-3" }); yield return(new object[] { NestedDictionary <ulong> .WithInvalidChild(3), "3" }); yield return(new object[] { NestedDictionary <bool> .WithInvalidChild(true), "True" }); yield return(new object[] { NestedDictionary <bool> .WithInvalidChild(false), "False" }); yield return(new object[] { NestedDictionary <float> .WithInvalidChild(4f), "4" }); yield return(new object[] { NestedDictionary <double> .WithInvalidChild(5d), "5" }); yield return(new object[] { NestedDictionary <byte> .WithInvalidChild(6), "6" }); }
public StoneRemoveSuccess(int ReturnStoneNum, int ItemNum, NestedDictionary <byte, byte, int, List <ItemAttr> > infos, byte last) { /*FF 91 05 01 00 00 00 01 41 D2 00 00 00 00 00 00 * 77 E5 00 00 03 01 04 61 D1 00 00 01 25 00 00 00 * 80 3F 02 09 00 00 00 00 00 03 09 0D D2 00 00 02 * 02 00 CD CC 4C 3D 7B 17 00 00 40 40 10*/ ns.Write((byte)0xFF); ns.Write((short)0x591); ns.Write(1); ns.Write((byte)1); ns.Write(ReturnStoneNum); ns.Write(0); ns.Write(ItemNum); ns.Write((byte)infos.Count); foreach (var i in infos) { ns.Write(i.Key); //SeqNum foreach (var j in i.Value) { ns.Write(j.Key); //SocketNum foreach (var k in j.Value) { ns.Write(k.Key); //StoneNum ns.Write((byte)k.Value.Count(c => c.AttrValue > 0)); //attr count foreach (var x in k.Value.Where(c => c.AttrValue > 0)) { ns.Write(x.Attr); //attr 6011 = point ns.Write(x.AttrValue); } } } } ns.Write(last); }
public NestedDictionary <string, string> GetDebugInfo() { var retval = new NestedDictionary <string, string>(); retval["Contents"] = _application.GetDebugInfo(); return(retval); }
public static NestedDictionary <string, string> GetDebugInfo(this HttpSessionState nameObjectCollectionBase) { var retval = new NestedDictionary <string, string>(); nameObjectCollectionBase.Cast <object>().ForEach(key => retval[key.ToString()].Value = nameObjectCollectionBase[key.ToString()].ToString()); return(retval); }
public void Assigners() { var dict = new NestedDictionary { ["unknownField"] = 3, ["time"] = "2018-10-31", ["String"] = "asdf", ["Int"] = "123", ["Decimal"] = "123.52", ["StringArray"] = new List <string> { "a", "b", "cde" }, ["StringList"] = new[] { "a", "b", "cde" }, ["SubPoco2"] = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("Int", 3), new KeyValuePair <string, object>("IntArray", new[] { "1", "2", "3" }) }, ["SubPoco"] = new NestedDictionary { ["Int"] = 3, ["IntArray"] = new[] { "1", "2", "3" } }, ["SubPocos"] = new[] { new NestedDictionary { ["int"] = "3", ["IntArray"] = new[] { 1, 2, 3 } }, new NestedDictionary { ["Int"] = "4", ["intArray"] = new[] { "1", "2", "3", "4" } } }, ["SubPocos2"] = new List <KeyValuePair <string, object> >[] { new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("Int", 3), new KeyValuePair <string, object>("IntArray", new[] { "1", "2", "3" }) } } }; var poco = new Poco(); poco.Assign(dict); Assert.Equal(DateTime.Parse(dict["time"].ToString()), poco.Time); Assert.Equal("asdf", poco.String); Assert.Equal(123, poco.Int); Assert.Equal(123.52m, poco.Decimal); // TODO: list/array checking Assert.Equal(3, poco.SubPoco.Int); Assert.Equal(3, poco.SubPocos.First().Int); Assert.Equal(4, poco.SubPocos.Skip(1).First().Int); }
public void Level4_3Keys() { var dict = new NestedDictionary <int, bool, int, bool, string>(); dict[1, true, 2, false] = "Test"; Assert.True(dict.ContainsKey(1, true, 2)); Assert.Single(dict[1, true, 2]); }
public void Level2() { var dict = new NestedDictionary <int, bool, string>(); dict[1, true] = "Test"; Assert.True(dict.ContainsKey(1, true)); Assert.Equal("Test", dict[1, true]); }
public NestedDictionary <string, string> GetDebugInfo() { var retval = new NestedDictionary <string, string>(); retval["QueryString"].Value = _request.QueryString.ToString(); retval["Browser"].Value = _request.Browser.Browser; retval["Request"].Value = _request.RequestType; return(retval); }
private static void TryGetValue(NestedDictionary <string, int, bool, decimal> dictionary) { Console.WriteLine("---Try Get Value---"); Console.WriteLine(dictionary.TryGetValue("Oslo", out NestedDictionary <int, bool, decimal> value)); // True Console.WriteLine(dictionary.TryGetValue("Boston", 2011, out NestedDictionary <bool, decimal> value2)); // False Console.WriteLine(dictionary.TryGetValue("Boston", 2006, true, out decimal value3)); // True PrintDictionary(dictionary); }
public NestedDictionary <string, string> GetDebugInfo() { var retval = new NestedDictionary <string, string>(); retval["Application"] = Application.GetDebugInfo(); retval["Session"] = Session.GetDebugInfo(); retval["Request"] = Request.GetDebugInfo(); retval["Response"] = Response.GetDebugInfo(); return(retval); }
private static void ContainsValue(NestedDictionary <string, int, bool, decimal> dictionary) { Console.WriteLine("---Contains Value---"); Console.WriteLine(dictionary.ContainsValue(12m)); // True Console.WriteLine(dictionary.ContainsValue(5m)); // True Console.WriteLine(dictionary.ContainsValue(15m)); // False PrintDictionary(dictionary); }
public NestedDictionary <string, string> GetDebugInfo() { var retval = new NestedDictionary <string, string>(); retval["Status"].Value = _response.Status; retval["StatusCode"].Value = _response.StatusCode.ToString(); retval["StatusDescription"].Value = _response.StatusDescription; retval["ContentType"].Value = _response.ContentType; retval["RedirectLocation"].Value = _response.RedirectLocation; return(retval); }
private static void ContainsKey(NestedDictionary <string, int, bool, decimal> dictionary) { Console.WriteLine("---Contains Key---"); Console.WriteLine(dictionary.ContainsKey("Oslo")); // True Console.WriteLine(dictionary.ContainsKey("Oslo", 2008)); // True Console.WriteLine(dictionary.ContainsKey("Boston", 2006, false)); // True Console.WriteLine(dictionary.ContainsKey("Boston", 2011, false)); // False PrintDictionary(dictionary); }
public new NestedDictionary <TKey, TValue> this[TKey key] { set { base[key] = value; } get { if (!base.ContainsKey(key)) { base[key] = new NestedDictionary <TKey, TValue>(); } return(base[key]); } }
public new NestedDictionary <K, V> this[K key] { set { base[key] = value; } get { if (!base.Keys.Contains <K>(key)) { base[key] = new NestedDictionary <K, V>(); } return(base[key]); } }
private static void PrintDictionary(NestedDictionary <string, int, bool, decimal> dictionary) { Console.WriteLine(); foreach (KeyValuePair <string, NestedDictionary <int, bool, decimal> > kvp1 in dictionary) { foreach (KeyValuePair <int, NestedDictionary <bool, decimal> > kvp2 in kvp1.Value) { foreach (KeyValuePair <bool, decimal> kvp3 in kvp2.Value) { Console.WriteLine($"{kvp1.Key}\t-\t{kvp2.Key}\t-\t{kvp3.Key}\t-\t{kvp3.Value}"); } } } Console.WriteLine(); }
private static void InsertValue(NestedDictionary <string, int, bool, decimal> dictionary) { Console.WriteLine("---Insert Value---"); dictionary["York"][2006][true] = 98m; dictionary["York"][2009][false] = 14m; dictionary["Phoenix"] = new NestedDictionary <int, bool, decimal>() { { 2008, true, 5m }, { 2009, true, 5m }, }; PrintDictionary(dictionary); }
public static void LoadHelpDictionary() { XmlDocument xmlDoc = new XmlDocument(); string helpPath = Path.GetDirectoryName( Assembly.GetExecutingAssembly().GetName().CodeBase); string helpFileName = String.Format(@"Help\Help_{0}.xml", DC22.Shell.PL.DataTools.CurrentLanguage); string path = Path.Combine(helpPath, helpFileName); xmlDoc.Load(path); helpDictionary = new NestedDictionary <string, string>(); XmlNode x = xmlDoc.DocumentElement; DisplayNodes(x, ref parentIds); }
private static void Remove(NestedDictionary <string, int, bool, decimal> dictionary) { Console.WriteLine("---Remove---"); Console.WriteLine(dictionary.Remove("Oslo", 2009)); // True Console.WriteLine(dictionary.ContainsKey("Oslo", 2009)); // False Console.WriteLine(dictionary.ContainsKey("Oslo")); // True Console.WriteLine(dictionary.Remove("Oslo", 2007, true)); // True Console.WriteLine(dictionary.Remove("Oslo", 2011)); // False Console.WriteLine(dictionary.Remove("Boston")); // True PrintDictionary(dictionary); }
private static void getHelpDictionary(string key, Dictionary <string, NestedDictionary <string, string> > dictionary, ref Dictionary <string, NestedDictionary <string, string> > helpDictionary) { foreach (string dictionaryKey in dictionary.Keys) { if (dictionaryKey == key) { helpDictionary = dictionary[dictionaryKey]; break; } object nextLevel = dictionary[dictionaryKey]; if (nextLevel == null) { continue; } getHelpDictionary(key, (Dictionary <string, NestedDictionary <string, string> >)nextLevel, ref helpDictionary); } }
public NestedDictionary <string, string> GetDebugInfo() { var retval = new NestedDictionary <string, string>(); retval["SessionID"].Value = _session.SessionID; retval["Mode"].Value = _session.Mode.ToString(); retval["CookieMode"].Value = _session.CookieMode.ToString(); retval["IsCookieless"].Value = _session.IsCookieless.ToString(); retval["CodePage"].Value = _session.CodePage.ToString(); retval["IsNewSession"].Value = _session.IsNewSession.ToString(); retval["IsReadOnly"].Value = _session.IsReadOnly.ToString(); retval["IsSynchronized"].Value = _session.IsSynchronized.ToString(); retval["LCID"].Value = _session.LCID.ToString(); retval["Timeout"].Value = _session.Timeout.ToString(); retval["Count"].Value = _session.Count.ToString(); retval["Contents"] = _session.GetDebugInfo(); return(retval); }
private static void PrintCityDictionary(NestedDictionary <string, string, string, int, Place> dictionary) { Console.WriteLine(); foreach (KeyValuePair <string, NestedDictionary <string, string, int, Place> > kvp1 in dictionary) { foreach (KeyValuePair <string, NestedDictionary <string, int, Place> > kvp2 in kvp1.Value) { foreach (KeyValuePair <string, NestedDictionary <int, Place> > kvp3 in kvp2.Value) { foreach (KeyValuePair <int, Place> kvp4 in kvp3.Value) { Console.WriteLine($"{kvp1.Key} - {kvp2.Key} - {kvp3.Key} - {kvp4.Key} - {kvp4.Value}"); } } } } Console.WriteLine(); }
public EnchantItemInfo(int ItemNum, NestedDictionary <int, byte, byte, int, List <ItemAttr> > infos, byte last) { //FF 8B 05 01 00 00 00 FF FF FF FF 00 00 00 00 10 /*FF 8B 05 01 00 00 00 FF FF FF FF 02 00 00 00 * 35 02 00 00 01 01 04 05 D2 00 00 02 02 00 8F * C2 F5 3C 7B 17 00 00 80 3F 77 E5 00 00 03 01 * 04 61 D1 00 00 01 25 00 00 00 80 3F 02 09 00 * 00 00 00 00 03 09 00 00 00 00 00 08*/ ns.Write((byte)0xFF); ns.Write((short)0x58B); ns.Write(1); ns.Write(ItemNum); ns.Write(infos.Count); if (infos.Count == 0) { goto End; } foreach (var y in infos) { ns.Write(y.Key); //ItemNum ns.Write((byte)y.Value.Count); //socket count foreach (var i in y.Value) { ns.Write(i.Key); //SeqNum foreach (var j in i.Value) { ns.Write(j.Key); //SocketNum foreach (var k in j.Value) { ns.Write(k.Key); //StoneNum ns.Write((byte)k.Value.Count(c => c.AttrValue > 0)); //attr count foreach (var x in k.Value.Where(c => c.AttrValue > 0)) { ns.Write(x.Attr); //attr 6011 = point ns.Write(x.AttrValue); } } } } } End: ns.Write(last); }
private void LoopObject(NestedDictionary dict, JsonElement?jsonObj) { if (jsonObj == null || jsonObj.Value.ValueKind != JsonValueKind.Object) { return; } var obj = jsonObj.Value; foreach (var prop in obj.EnumerateObject()) { switch (prop.Value.ValueKind) { case JsonValueKind.Array: var subList = new List <object>(); foreach (var arrVal in prop.Value.EnumerateArray()) { if (arrVal.ValueKind == JsonValueKind.Object) { var subDict = new NestedDictionary(); subList.Add(subDict); LoopObject(subDict, arrVal); } else { subList.Add(GetJsonValue(arrVal)); } } dict[prop.Name] = subList; break; case JsonValueKind.Object: var newDict = new NestedDictionary(); dict.Set(prop.Name, newDict); LoopObject(newDict, prop.Value); break; default: dict.Set(prop.Name, GetJsonValue(prop.Value)); break; } } }
private static void GetValue(NestedDictionary <string, int, bool, decimal> dictionary) { Console.WriteLine("---Get Value---"); Console.WriteLine(dictionary["Oslo"][2007][true]); // 12m Console.WriteLine(dictionary["Boston"][2006][false]); // 5m // Get dictionary with Oslo only NestedDictionary <int, bool, decimal> osloDicionary = dictionary["Oslo"]; // Throws KeyNotFoundException try { decimal value = dictionary["Oslo"][99][false]; } catch (KeyNotFoundException ex) { Console.WriteLine(ex.Message); } PrintDictionary(dictionary); }
public async Task ProcessJson() { if (JsonProcessed) { return; } Json = new NestedDictionary(); if (!(_context.Request.ContentType?.Contains("json") ?? false)) { JsonProcessed = true; return; } // TODO: use encoding set in headers using (var reader = new StreamReader(_context.Request.Body, Encoding.UTF8, true, 10240, true)) { var @string = await reader.ReadToEndAsync(); LoopObject(Json, JsonSerializer.Deserialize <JsonElement>(@string, JsonSettings)); } JsonProcessed = true; }
private static void AddValue(NestedDictionary <string, int, bool, decimal> dictionary) { Console.WriteLine("---Add Value---"); dictionary.Add("York", 2017, true, 15m); dictionary.Add("York", 2016, true, 15m); dictionary.Add("Phoenix", 2016, new NestedDictionary <bool, decimal>() { { false, 12m } }); // Throws argument exception - key already in the dictionary try { dictionary.Add("Phoenix", 2016, false, 10m); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } // Throws argument exception - key already in the dictionary try { dictionary.Add("York", new NestedDictionary <int, bool, decimal>() { { 2011, false, 5m } }); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } PrintDictionary(dictionary); }
/// <summary> /// Extracts headers from a nested dictionary such as a repeater. /// </summary> /// <param name="nestedFields">The nested dictionary to extract headers from.</param> /// <param name="headers">The populated output of nested sub headers.</param> private void ExtractHeaders(NestedDictionary nestedFields, Dictionary<string, object> headers) { foreach (var nestedField in nestedFields) { if (!headers.ContainsKey(nestedField.Key)) { headers.Add(nestedField.Key, null); } } }
public void RepeaterRowValues() { Application application = new Application(new ApplicationData(), Guid.NewGuid().ToString("N")); List<NestedDictionary> repeater = new List<NestedDictionary>(); NestedDictionary child1 = new NestedDictionary(); child1["Title"] = "The Final Destination (4)"; child1["Year"] = "2009"; NestedDictionary child2 = new NestedDictionary(); child2["Title"] = "Final Destination 5"; child2["Year"] = "2011"; repeater.Add(child1); repeater.Add(child2); application.ApplicationData["Repeater"] = repeater.ToArray(); MappedFieldList fieldMap = new MappedFieldList { new MappedField { MapType = MapType.Field, Source = "Repeater", Target = "FinalDestinations" } }; new XmlEndpointRequestMapper().Map(application, fieldMap, this.xmlDoc); XmlNodeList nodeList = this.xmlDoc.GetElementsByTagName("Item"); Assert.AreEqual(2, nodeList.Count); Assert.AreEqual("2009", nodeList[0].SelectNodes("Year")[0].InnerText); Assert.AreEqual("2011", nodeList[1].SelectNodes("Year")[0].InnerText); }
/// <summary> /// Populates <paramref name="target"/> with values from <paramref name="source"/> and <paramref name="response"/> /// as defined by <paramref name="fieldMap"/>. It also returns a new <see cref="Newtonsoft.Json.Linq.JObject"/> with mapped values. /// </summary> /// <param name="source">The response body from which to get values.</param> /// <param name="response">The response object from which to get values.</param> /// <param name="fieldMap">A definition of field mappings.</param> /// <param name="target">The target object to populate with mapped key/values.</param> /// <returns>A new <see cref="Newtonsoft.Json.Linq.JObject"/> with mapped values.</returns> public JObject MapObject(JObject source, HttpWebResponse response, MappedFieldList fieldMap, ApplicationData target) { JObject outObject = new JObject(); IEnumerable<MappedField> validMappings = fieldMap.Where(m => !string.IsNullOrEmpty(m.Target) && !string.IsNullOrEmpty(m.Source)); foreach (MappedField map in validMappings) { switch (map.MapType) { case MapType.Content: JToken token = source.SelectToken(map.Source); if (token != null) { outObject.Add(map.Target, token); if (target != null) { if (token.Type == JTokenType.Array && token.First().Type == JTokenType.Object) { var repeater = new NestedDictionary[token.Children().Count()]; var i = 0; foreach (var row in token) { repeater[i] = new NestedDictionary(); foreach (JProperty fieldProp in row.OfType<JProperty>()) { object targetValue = fieldProp.Value.Type == JTokenType.Array ? fieldProp.Value.Values<string>().ToArray() as object : fieldProp.Value.ToString(); if (repeater[i].ContainsKey(fieldProp.Name)) { repeater[i][fieldProp.Name] = targetValue; } else { repeater[i].Add(fieldProp.Name, targetValue); } } i++; } target.SetValue(map.Target, repeater); } else { object targetValue = token.Type == JTokenType.Array ? token.Values<string>().ToArray() as object : token.Value<string>(); target.SetValue(map.Target, targetValue, true); } } } break; case MapType.Property: this.MapPropertyField(response, map, target); break; default: throw new InvalidOperationException(string.Format(ExceptionMessages.InvalidMapType, map.MapType)); } } return outObject; }
public void RepeaterRowValues() { Application application = new Application(new ApplicationData(), Guid.NewGuid().ToString("N")); List<NestedDictionary> repeater = new List<NestedDictionary>(); NestedDictionary child1 = new NestedDictionary(); child1["Title"] = "The Final Destination (4)"; child1["Year"] = "2009"; NestedDictionary child2 = new NestedDictionary(); child2["Title"] = "Final Destination 5"; child2["Year"] = "2011"; repeater.Add(child1); repeater.Add(child2); application.ApplicationData["Repeater"] = repeater.ToArray(); MappedFieldList fieldMap = new MappedFieldList { new MappedField { MapType = MapType.Field, Source = "Repeater", Target = "FinalDestinations" } }; JObject jobj = new JObject(); new JsonEndpointRequestMapper().Map(application, fieldMap, jobj); Assert.AreEqual("2009", jobj.GetValue("FinalDestinations").First["Year"]); Assert.AreEqual("2011", jobj.GetValue("FinalDestinations").First.Next["Year"]); }
public void RepeaterRowValues() { Application application = new Application(new ApplicationData(), Guid.NewGuid().ToString("N")); List<NestedDictionary> repeater = new List<NestedDictionary>(); NestedDictionary child1 = new NestedDictionary(); child1["Title"] = "The Final Destination (4)"; child1["Year"] = "2009"; NestedDictionary child2 = new NestedDictionary(); child2["Title"] = "Final Destination 5"; child2["Year"] = "2011"; repeater.Add(child1); repeater.Add(child2); application.ApplicationData["Repeater"] = repeater.ToArray(); MappedFieldList fieldMap = new MappedFieldList { new MappedField { MapType = MapType.Field, Source = "Repeater", Target = "FinalDestinations" } }; Dictionary<string, string> dictionary = new Dictionary<string, string>(); new HttpVarEndpointRequestMapper().Map(application, fieldMap, dictionary); Assert.AreEqual("2009", dictionary["FinalDestinations-1-Year"]); Assert.AreEqual("2011", dictionary["FinalDestinations-2-Year"]); }