public void Add_Name_Null() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); 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 GetValue_Name_Empty() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.GetValue(string.Empty); }
public void GetValue__Name_Null() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.GetValue((string)null); }
public void Add_Name_Empty() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add(string.Empty); }
/// <summary> /// Creates a <see cref="vCardProperty"/> object with the /// specified name and value. /// </summary> /// <remarks> /// The vCard specification supports multiple values in /// certain fields, such as the N field. The value specified /// in this constructor is loaded as the first value. /// </remarks> public vCardProperty(string name, string value) { this.group = string.Empty; this.name = name; this.subproperties = new vCardSubpropertyCollection(); this.value = value; }
/// <summary> /// Creates a <see cref="vCardProperty"/> object /// with the specified name and a null value. /// </summary> /// <param name="name"> /// The name of the property. /// </param> public vCardProperty(string name) { this.group = string.Empty; this.language = string.Empty; this.name = name; this.subproperties = new vCardSubpropertyCollection(); }
public void Contains_Empty() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); Assert.IsFalse( subs.Contains(string.Empty)); }
public void Contains_Null() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); Assert.IsFalse( subs.Contains((string)null)); }
public void Add_Name_Null() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); Assert.Throws <ArgumentNullException>(() => subs.Add((string)null)); }
public void GetValue_Name_Empty() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); Assert.Throws <ArgumentNullException>(() => subs.GetValue(string.Empty)); }
public void Add_Name_Null() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add((string)null); }
public void Add_Name_Empty() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add(string.Empty); }
public void IndexOf_EmptyName() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); // IndexOf should not raise an exception for an empty string. Assert.AreEqual( -1, subs.IndexOf(string.Empty)); }
public void GetValue_Name_ValueDoesNotExist() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); string value1 = subs.GetValue("NAME"); Assert.IsNull( value1, "A null value should have been returned."); }
public void IndexOf_Null() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); // The IndexOf method should not raise an exception // for a null string. It should return -1 to indicate // the name was not located. Assert.AreEqual( -1, subs.IndexOf((string)null)); }
public void IndexOf_MissingValueInEmptyCollection() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); // This test ensures that an empty collection // does not cause an error (e.g. it catches any // code that assumes the collection to be non-empty). Assert.AreEqual( -1, subs.IndexOf("NAME")); }
public void IndexOfAny_NoMatches_EmptyCollection() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); int index = subs.IndexOfAny( new string[] { "FIND1", "FIND2", "FIND3" }); Assert.AreEqual( -1, index, "No matches should have been found."); }
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 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 GetValue_ValueList_NameDoesNotExist_NullList() { // The GetValue function should work even if // the potential value list is null. vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); string value = subs.GetValue("NAME", (string[])null); Assert.IsNull( value, "The value should be null."); }
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 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."); }
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 AddOrUpdate_UpdatedValue() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.AddOrUpdate("NAME", "VALUE"); Assert.AreEqual( 1, subs.Count, "Only one property should be in the collection."); Assert.AreEqual( "NAME", subs[0].Name, "The subproperty does not have the correct name."); Assert.AreEqual( "VALUE", subs[0].Value, "The subproperty does not have the correct value."); subs.AddOrUpdate("NAME", "VALUE2"); Assert.AreEqual( 1, subs.Count, "Only one property should be in the collection."); Assert.AreEqual( "NAME", subs[0].Name, "The subproperty does not have the correct name."); Assert.AreEqual( "VALUE2", subs[0].Value, "The subproperty does not have the updated value."); }
public void AddOrUpdate_UpdatedValue() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.AddOrUpdate("NAME", "VALUE"); Assert.AreEqual( 1, subs.Count, "Only one property should be in the collection."); Assert.AreEqual( "NAME", subs[0].Name, "The subproperty does not have the correct name."); Assert.AreEqual( "VALUE", subs[0].Value, "The subproperty does not have the correct value."); subs.AddOrUpdate("NAME", "VALUE2"); Assert.AreEqual( 1, subs.Count, "Only one property should be in the collection."); Assert.AreEqual( "NAME", subs[0].Name, "The subproperty does not have the correct name."); Assert.AreEqual( "VALUE2", subs[0].Value, "The subproperty does not have the updated value."); }
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_NullList() { // The GetValue function should work even if // the potential value list is null. vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); string value = subs.GetValue("NAME", (string[])null); Assert.IsNull( value, "The value should be null."); }
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."); }
/// <summary> /// Initializes the vCard property with the specified /// name and values. /// </summary> public vCardProperty(string name, vCardValueCollection values) : this() { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); if (values == null) throw new ArgumentNullException("values"); this.subproperties = new vCardSubpropertyCollection(); this.name = name; this.value = values; }
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 IndexOf_Null() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); // The IndexOf method should not raise an exception // for a null string. It should return -1 to indicate // the name was not located. Assert.AreEqual( -1, subs.IndexOf((string)null)); }
public void IndexOf_MissingValueInEmptyCollection() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); // This test ensures that an empty collection // does not cause an error (e.g. it catches any // code that assumes the collection to be non-empty). Assert.AreEqual( -1, subs.IndexOf("NAME")); }
public void GetValue_Name_Empty() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.GetValue(string.Empty); }
public void Contains_Null() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); Assert.IsFalse( subs.Contains((string)null)); }
public void Contains_Empty() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); Assert.IsFalse( subs.Contains(string.Empty)); }
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."); }
/// <summary> /// Creates a <see cref="vCardProperty"/> with the /// specified name and a byte array as a value. /// </summary> /// <param name="name">The name of the property.</param> /// <param name="value">The value as a byte array.</param> public vCardProperty(string name, byte[] value) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); this.group = string.Empty; this.name = name == null ? string.Empty : name; this.subproperties = new vCardSubpropertyCollection(); this.value = value; }
/// <summary> /// Creates a <see cref="vCardProperty"/> object /// with the specified name and a null value. /// </summary> /// <param name="name"> /// The name of the property. /// </param> public vCardProperty(string name) { this.name = name; this.subproperties = new vCardSubpropertyCollection(); }
/// <summary> /// Creates a blank <see cref="vCardProperty"/> object. /// </summary> public vCardProperty() { this.subproperties = new vCardSubpropertyCollection(); }
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 IndexOf_EmptyName() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); // IndexOf should not raise an exception for an empty string. Assert.AreEqual( -1, subs.IndexOf(string.Empty)); }
public void GetValue__Name_Null() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.GetValue((string)null); }
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 GetValue_Name_ValueDoesNotExist() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); string value1 = subs.GetValue("NAME"); Assert.IsNull( value1, "A null value should have been returned."); }
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."); }
/// <summary> /// Initializes a vCardProperty with the specified /// name, value and group. /// </summary> /// <param name="name"> /// The name of the vCard property. /// </param> /// <param name="value"> /// The value of the vCard property. /// </param> /// <param name="group"> /// The group name of the vCard property. /// </param> public vCardProperty(string name, string value, string group) { this.group = group == null ? string.Empty : group; this.name = name == null ? string.Empty : name; this.subproperties = new vCardSubpropertyCollection(); this.value = value; }
/// <summary> /// Creates a <see cref="vCardProperty"/> with /// the specified name and date/time as a value. /// </summary> /// <param name="name">The name of the property.</param> /// <param name="value">The date/time value.</param> public vCardProperty(string name, DateTime value) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); this.name = name; this.subproperties = new vCardSubpropertyCollection(); this.value = value; }