public void Collections_ListSafe_GetValue() { var kvList = new KeyValueListString(); kvList.Add("Key1", "Value1"); kvList.Add("Key2", "Value2"); Assert.IsTrue(kvList.GetValue("Key1") != TypeExtension.DefaultString); }
public void Core_Collections_ListSafe_GetValue() { var kvList = new KeyValueListString(); kvList.Add("Key1", "Value1"); kvList.Add("Key2", "Value2"); Assert.IsTrue(kvList.GetValue("Key1") != string.Empty); }
public void Core_Collections_ListSafe_Remove() { var kvList = new KeyValueListString(); kvList.Add("Key1", "Value1"); kvList.Add("Key2", "Value2"); kvList.Remove("Key1"); Assert.IsTrue(kvList.Count == 1); }
public void Core_Collections_KeyValueListString_Add() { var kvString = new KeyValueListString(); kvString.Add("TestKey", "TestValue"); Assert.AreEqual(1, kvString.Count); kvString.Add("TestKey", "TestValue2"); Assert.AreNotEqual(2, kvString.Count); }
/// <summary> /// Binds a standard key-value pair to a ComboBox /// </summary> /// <param name="item"></param> /// <param name="collection"></param> /// <param name="selectedKey"></param> /// <param name="bindingProperty"></param> public void SetBinding(ref ComboBox item, KeyValueListString collection, string selectedKey, string bindingProperty) { item.ItemsSource = collection; item.DisplayMemberPath = "Value"; item.SelectedValuePath = "Key"; item.SetBinding(ComboBox.SelectedValueProperty, new Binding() { Path = new PropertyPath(bindingProperty), Mode = BindingMode.TwoWay }); // Handle for no state if (collection.Count == 1) { selectedKey = collection.FirstOrDefaultSafe().Key; } item.SelectedValue = selectedKey; }
public void Core_Collections_KeyValueListString_Construct() { var kvList = new KeyValueListString(); Assert.AreEqual(0, kvList.Count); }
/// <summary> /// Constructor that formats the entire URL, complete with PROTOCOL://SERVER_NAME:PORT/APPLICATION_PATH/Parameter1/Parameter2/.../ParameterN/ /// </summary> /// <param name="urlNoQuerystring">Url with everything but parameters and punctuation</param> /// <param name="parameters">Collection of parameters to add to Url</param> /// <returns>Constructed url</returns> public UrlBuilder(string urlNoQuerystring, KeyValueListString parameters) : base(urlNoQuerystring.AddLast("/") + parameters.ToString("QS")) { }