Example #1
0
 public void TestDuplicateEntriesRemoved()
 {
     DelimitedList cdl = new DelimitedList(',', "item1,item2,item3,item2,item4");
     Assert.AreEqual(4, cdl.Count);
     Assert.IsTrue(cdl.IsInList("item1"));
     Assert.IsTrue(cdl.IsInList("item2"));
     Assert.IsTrue(cdl.IsInList("item3"));
     Assert.IsTrue(cdl.IsInList("item4"));
 }
Example #2
0
 public void TestGetItems()
 {
     DelimitedList cdl = new DelimitedList(':', "item2:item4:item3:item1");
     HashSet<string> items = cdl.Items;
     Assert.AreEqual(4, items.Count);
     Assert.IsTrue(cdl.IsInList("item1"));
     Assert.IsTrue(cdl.IsInList("item2"));
     Assert.IsTrue(cdl.IsInList("item3"));
     Assert.IsTrue(cdl.IsInList("item4"));
 }
Example #3
0
 /// <summary>
 /// Constructor
 /// Note: no validation of input is performed in the constructor. Call Validate after
 /// the constructor and when changing values.
 /// </summary>
 /// <param name="grids">list of two or four grid squares</param>
 public VUCC_Grids(string grids)
 {
     string[] gs = grids.Split(',');
     string grds = string.Empty;
     char[] trimChars = new char[1];
     trimChars[0] = ' ';
     foreach(string grid in gs)
     {
         string gr = grid.Trim(trimChars);
         grds += gr + ",";
     }
     grds = grds.Substring(0, grds.Length - 1);
     gridSquares = new DelimitedList(',', grds);
 }
Example #4
0
 /// <summary>
 /// Constructor
 /// Note: no validation of input is performed in the constructor. Call Validate after
 /// the constructor and when changing values.
 /// </summary>
 /// <param name="cnties">list of two counties separated by ':'</param>
 public Usaca_Counties(string cnties)
 {
     counties = new DelimitedList(':', cnties);
 }
Example #5
0
 public void TestIsInList()
 {
     DelimitedList cdl = new DelimitedList(',', "item1,item2,item3,item4");
     Assert.IsTrue(cdl.IsInList("item1"));
     Assert.IsTrue(cdl.IsInList("item4"));
 }
Example #6
0
 public void TestCount0()
 {
     DelimitedList cdl = new DelimitedList(',', string.Empty);
     Assert.AreEqual(0, cdl.Count);
 }
Example #7
0
 public void TestCount()
 {
     DelimitedList cdl = new DelimitedList(',', "item1,item2,item3,item4");
     Assert.AreEqual(4, cdl.Count);
 }
Example #8
0
 public void TestToStringEmpty()
 {
     DelimitedList cdl = new DelimitedList(',', string.Empty);
     Assert.AreEqual(string.Empty, cdl.ToString());
 }
Example #9
0
 public void TestToString()
 {
     DelimitedList cdl = new DelimitedList(',', "item1,item2,item3");
     Assert.AreEqual("item1,item2,item3", cdl.ToString());
 }
Example #10
0
 public void TestIsInListWhiteSpace()
 {
     DelimitedList cdl = new DelimitedList(':', "item1 : item2:  item3:item4 ");
     Assert.IsTrue(cdl.IsInList("item1"));
     Assert.IsTrue(cdl.IsInList("item2"));
     Assert.IsTrue(cdl.IsInList("item3"));
     Assert.IsTrue(cdl.IsInList("item4"));
 }
Example #11
0
 public void TestIsInListNotInList()
 {
     DelimitedList cdl = new DelimitedList(',', "item1,item2,item3,item4");
     Assert.IsFalse(cdl.IsInList("item6"));
 }
        /// <summary>
        /// Constructor
        /// Note: no validation of input is performed in the constructor. Call Validate after
        /// the constructor and when changing values.
        /// </summary>
        /// <param name="separator">list delimiter</param>
        /// <param name="list">delimited list</param>
        /// <param name="enumeration">name of enumeration in AdifEnumerations</param>
        /// <param name="aEnums">AdifEnumerations object containing the enumeration</param>
        public DelimitedListEnumeration(char separator, string list, string enumeration,
		                                AdifEnumerations aEnums)
            : base(enumeration, aEnums)
        {
            delimList = new DelimitedList(separator, list);
        }