public void testList010() { EmailList el = new EmailList(); // Using the generic "Wrap" API so that we can use this // test against any internationalized version of the ADK Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**"); Email email2 = new Email(EmailType.Wrap("foo"), "*****@*****.**"); el.Add(email1); Assert.AreEqual(1, el.ChildCount, "Should have 1 email"); el.Add(email2); Assert.AreEqual(2, el.ChildCount, "Should have 2 emails"); Email[] children = el.ToArray(); Assert.AreEqual(2, children.Length, "Should have 2 array elements"); el.RemoveChild(email2); Assert.AreEqual(1, el.ChildCount, "Should have 1 email"); el.RemoveChild(email1); Assert.AreEqual(0, el.ChildCount, "Should have 0 emails"); children = el.ToArray(); Assert.AreEqual(0, children.Length, "Should have 0 array elements"); }
public void testList020() { EmailList el = new EmailList(); // Using the generic "Wrap" API so that we can use this // test against any internationalized version of the ADK Email email1 = new Email( EmailType.Wrap( "asdfasdf" ), "*****@*****.**" ); Email email2 = new Email( EmailType.Wrap( "Primary" ), "*****@*****.**" ); el.Add(email1); Assert.AreEqual(1, el.ChildCount, "Should have 1 email"); el.Add(email2); Assert.AreEqual(2, el.ChildCount, "Should have 2 emails"); Email email3 = new Email(); email3.Type = "Alternate1"; el.Add(email3); Assert.AreEqual(3, el.ChildCount, "Should have 3 emails"); Email primary = el[EmailType.PRIMARY]; Assert.IsNotNull( primary ); primary = el["Primary"]; Assert.IsNotNull(primary); Email secondary = el[EmailType.ALT1]; Assert.IsNotNull(secondary); secondary = el["Alternate1"]; Assert.IsNotNull(secondary); }
public void testList020() { EmailList el = new EmailList(); // Using the generic "Wrap" API so that we can use this // test against any internationalized version of the ADK Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**"); Email email2 = new Email(EmailType.Wrap("foo"), "*****@*****.**"); el.Add(email1); el.Add(email2); Assert.IsNotNull(email1.Parent, "Parent should not be null"); Assert.IsNotNull(email2.Parent, "Parent should not be null"); el.Clear(); Assert.AreEqual(0, el.ChildCount, "Should have 0 emails"); Assert.IsNull(email1.Parent, "Parent should be null"); Assert.IsNull(email2.Parent, "Parent should be null"); }
public void testList030() { EmailList el = new EmailList(); // Using the generic "Wrap" API so that we can use this // test against any internationalized version of the ADK Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**"); Email email2 = new Email(EmailType.Wrap("bar"), "*****@*****.**"); el.Add(email1); el.Add(email2); // test the iterator int count = 0; foreach (Email e in el) { Assert.IsNotNull(e, "Email should not be null"); Assert.AreEqual(24, e.TextValue.Length, "Should have email address"); count++; } Assert.AreEqual(2, count, "Should have iterated 2 emails"); }
/// <summary> /// Sets all Email object instances. All existing /// <c>Email</c> instances /// are removed and replaced with this list. Calling this method with the /// parameter value set to null removes all <c>Emails</c>. /// </summary> /// <remarks> /// <para>Version: 1.5r1</para> /// <para>Since: 1.5r1</para> /// </remarks> public void SetEmails( Email[] items) { SetChildren( HrfinDTD.VENDORINFO_EMAIL, items ); }
/// <summary>Adds a new <c><Email></c> child element.</summary> /// <param name="val">A Email object</param> /// <remarks> /// <para>The SIF specification defines the meaning of this element as: "This is the vendor's email address number (In SIF 2.x use the ContactInfo element)"</para> /// <para>Version: 1.5r1</para> /// <para>Since: 1.5r1</para> /// </remarks> public void AddEmail( Email val ) { AddChild( HrfinDTD.VENDORINFO_EMAIL, val ); }