예제 #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"));
 }
예제 #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"));
 }
예제 #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);
 }
예제 #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);
 }
예제 #5
0
 public void TestIsInList()
 {
     DelimitedList cdl = new DelimitedList(',', "item1,item2,item3,item4");
     Assert.IsTrue(cdl.IsInList("item1"));
     Assert.IsTrue(cdl.IsInList("item4"));
 }
예제 #6
0
 public void TestCount0()
 {
     DelimitedList cdl = new DelimitedList(',', string.Empty);
     Assert.AreEqual(0, cdl.Count);
 }
예제 #7
0
 public void TestCount()
 {
     DelimitedList cdl = new DelimitedList(',', "item1,item2,item3,item4");
     Assert.AreEqual(4, cdl.Count);
 }
예제 #8
0
 public void TestToStringEmpty()
 {
     DelimitedList cdl = new DelimitedList(',', string.Empty);
     Assert.AreEqual(string.Empty, cdl.ToString());
 }
예제 #9
0
 public void TestToString()
 {
     DelimitedList cdl = new DelimitedList(',', "item1,item2,item3");
     Assert.AreEqual("item1,item2,item3", cdl.ToString());
 }
예제 #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"));
 }
예제 #11
0
 public void TestIsInListNotInList()
 {
     DelimitedList cdl = new DelimitedList(',', "item1,item2,item3,item4");
     Assert.IsFalse(cdl.IsInList("item6"));
 }
예제 #12
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="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);
        }