public void Add_Name_Null()
        {
            vCardSubpropertyCollection subs =
                new vCardSubpropertyCollection();

            subs.Add((string)null);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 6
0
 /// <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;
 }
Esempio n. 7
0
 /// <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();
 }
Esempio n. 8
0
        public void Contains_Empty()
        {
            vCardSubpropertyCollection subs = new vCardSubpropertyCollection();

            Assert.IsFalse(
                subs.Contains(string.Empty));
        }
Esempio n. 9
0
        public void Contains_Null()
        {
            vCardSubpropertyCollection subs = new vCardSubpropertyCollection();

            Assert.IsFalse(
                subs.Contains((string)null));
        }
Esempio n. 10
0
        public void Add_Name_Null()
        {
            vCardSubpropertyCollection subs =
                new vCardSubpropertyCollection();

            Assert.Throws <ArgumentNullException>(() => subs.Add((string)null));
        }
Esempio n. 11
0
        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);

        }
Esempio n. 14
0
        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));
        }
Esempio n. 15
0
        public void GetValue_Name_ValueDoesNotExist()
        {
            vCardSubpropertyCollection subs =
                new vCardSubpropertyCollection();

            string value1 = subs.GetValue("NAME");

            Assert.IsNull(
                value1,
                "A null value should have been returned.");
        }
Esempio n. 16
0
        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));
        }
Esempio n. 17
0
        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"));
        }
Esempio n. 18
0
        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.");
        }
Esempio n. 19
0
        public void IndexOf_MissingValueInPopulatedCollection()
        {
            vCardSubpropertyCollection subs =
                new vCardSubpropertyCollection();

            subs.Add("NAME1");
            subs.Add("NAME2");
            subs.Add("NAME3");

            Assert.AreEqual(
                -1,
                subs.IndexOf("NAME"));
        }
Esempio n. 20
0
        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.");
        }
Esempio n. 21
0
        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.");
        }
Esempio n. 22
0
        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);
        }
Esempio n. 23
0
        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.");
        }
Esempio n. 24
0
        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.");

        }
Esempio n. 26
0
        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.");
        }
Esempio n. 27
0
        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.");

        }
Esempio n. 31
0
        /// <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.");

        }
Esempio n. 39
0
        /// <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;
        }
Esempio n. 40
0
 /// <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();
 }
Esempio n. 41
0
 /// <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.");

        }
Esempio n. 49
0
 /// <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;
 }
Esempio n. 50
0
        /// <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;
        }