public void IndexOf_MissingValueInPopulatedCollection() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add("NAME1"); subs.Add("NAME2"); subs.Add("NAME3"); Assert.AreEqual( -1, subs.IndexOf("NAME")); }
public void Add_Name_Null() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); Assert.Throws <ArgumentNullException>(() => subs.Add((string)null)); }
public void Contains() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add("NAME"); Assert.IsTrue( subs.Contains("NAME"), "The collection should contain the specified subproperty."); Assert.IsTrue( subs.Contains("namE"), "Subproperty names are not case-sensitive."); Assert.IsFalse( subs.Contains((string)null), "The Contains method should not return True for null."); Assert.IsFalse( subs.Contains(string.Empty), "The Contains method should not return True for Empty."); Assert.IsFalse( subs.Contains("SOMENAME"), "There is no subproperty with the specified name."); }
public void IndexOfAny_OneMatch() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add("NAME0"); subs.Add("NAME1"); subs.Add("NAME2"); int index = subs.IndexOfAny( new string[] { "FIND0", "NAME1", "FIND2" }); Assert.AreEqual( 1, index); }
public void Add_Name_Empty() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add(string.Empty); }
public void Add_Name_Null() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add((string)null); }
public void IndexOfAny_NoMatches_PopulatedCollection() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add("NAME1"); subs.Add("NAME2"); subs.Add("NAME3"); int index = subs.IndexOfAny( new string[] { "FIND1", "FIND2", "FIND3" }); Assert.AreEqual( -1, index, "No matches should have been found."); }
public void GetValue_Name_ValueExists() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add("NAME", "VALUE"); string value = subs.GetValue("NAME"); Assert.AreEqual( "VALUE", value, "The value should have been returned."); }
public void IndexOf() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add("NAME0"); subs.Add("NAME1"); subs.Add("NAME2"); Assert.AreEqual( 0, subs.IndexOf("NAME0"), "The subproperty should be at index 0."); Assert.AreEqual( 1, subs.IndexOf("NAME1"), "The subproperty should be at index 1."); Assert.AreEqual( 2, subs.IndexOf("NAME2"), "The subproperty should be at index 2."); }
public void GetValue_ValueList_NameExists_NullList() { // The GetValue function should work even if // the potential value list is null. vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add("NAME", "VALUE"); string value = subs.GetValue("NAME", (string[])null); Assert.AreEqual( "VALUE", value, "The value should have been returned despite the null list."); }
public void GetValue_ValueList_NameDoesNotExist_ListValueExists() { // The GetValue function should work even if // the potential value list is null. vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add("VALUE"); string value = subs.GetValue("NAME", new string[] { "ABC", "VALUE" }); Assert.AreEqual( "VALUE", value, "The value should have been returned."); }