Esempio n. 1
0
 public void TestMailbox()
 {
     Parser p = new Parser("*****@*****.**");
     Parser.Addresses addrs = p.parseMailboxOrGroup();
     int cnt = 0;
     foreach (Parser.Address addr in addrs.addresses())
         cnt++;
     Assert.AreEqual(1, cnt, "Expected one address");
     IEnumerator<Parser.Address> addresses = addrs.addresses().GetEnumerator();
     addresses.MoveNext();
     Parser.Address theaddr = addresses.Current;
     Assert.AreEqual(theaddr.name, "*****@*****.**");
 }
Esempio n. 2
0
 public void TestMailboxWithAtomsName()
 {
     Parser p = new Parser("Mary Smith <*****@*****.**>");
     Parser.Addresses addrs = p.parseMailboxOrGroup();
     int cnt = 0;
     foreach (Parser.Address addr in addrs.addresses())
         cnt++;
     Assert.AreEqual(1, cnt, "Expected one address");
     IEnumerator<Parser.Address> addresses = addrs.addresses().GetEnumerator();
     addresses.MoveNext();
     Parser.Address theaddr = addresses.Current;
     Assert.AreEqual("Mary Smith <*****@*****.**>", theaddr.name);
 }
Esempio n. 3
0
 public void TestMailboxWithBigGroup()
 {
     Parser p = new Parser("A Group(Some people)\r\n" +
         "     :Chris Jones <c@(Chris's host.)public.example>,\r\n" +
         "            [email protected],\r\n" +
         "     John <*****@*****.**> (my dear friend); (the end of the group)");
     Parser.Addresses addrs = p.parseMailboxOrGroup();
     int cnt = 0;
     foreach (Parser.Address addr in addrs.addresses())
         cnt++;
     Assert.AreEqual(3, cnt, "Expected one address");
     IEnumerator<Parser.Address> addresses = addrs.addresses().GetEnumerator();
     addresses.MoveNext();
     Parser.Address theaddr = addresses.Current;
     Assert.AreEqual("Chris Jones <*****@*****.**>", theaddr.name);
     addresses.MoveNext();
     theaddr = addresses.Current;
     Assert.AreEqual(" [email protected]", theaddr.name);
     addresses.MoveNext();
     theaddr = addresses.Current;
     Assert.AreEqual(" John <*****@*****.**>", theaddr.name);
 }
Esempio n. 4
0
 public void TestObsoleteMailboxWithCommentsInAddress()
 {
     Parser p = new Parser("John Doe <jdoe@machine(comment).  example>");
     Parser.Addresses addrs = p.parseMailboxOrGroup();
     int cnt = 0;
     foreach (Parser.Address addr in addrs.addresses())
         cnt++;
     Assert.AreEqual(1, cnt, "Expected one address");
     IEnumerator<Parser.Address> addresses = addrs.addresses().GetEnumerator();
     addresses.MoveNext();
     Parser.Address theaddr = addresses.Current;
     Assert.AreEqual("John Doe <jdoe@machine. example>", theaddr.name);
 }
Esempio n. 5
0
 public void TestObsoleteMailboxWithoutQuotesAroundDot()
 {
     Parser p = new Parser("Joe Q. Public <*****@*****.**>");
     Parser.Addresses addrs = p.parseMailboxOrGroup();
     int cnt = 0;
     foreach (Parser.Address addr in addrs.addresses())
         cnt++;
     Assert.AreEqual(1, cnt, "Expected one address");
     IEnumerator<Parser.Address> addresses = addrs.addresses().GetEnumerator();
     addresses.MoveNext();
     Parser.Address theaddr = addresses.Current;
     Assert.AreEqual("Joe Q. Public <*****@*****.**>", theaddr.name);
 }
Esempio n. 6
0
 public void TestMailboxWithSmallgGroup()
 {
     Parser p = new Parser("(Empty list)(start)Hidden recipients  :(nobody(that I know))  ;");
     Parser.Addresses addrs = p.parseMailboxOrGroup();
     int cnt = 0;
     foreach (Parser.Address addr in addrs.addresses())
         cnt++;
     Assert.AreEqual(1, cnt, "Expected one address");
     IEnumerator<Parser.Address> addresses = addrs.addresses().GetEnumerator();
     addresses.MoveNext();
     Parser.Address theaddr = addresses.Current;
     Assert.AreEqual(null, theaddr.name);
 }
Esempio n. 7
0
 public void TestMailboxWithQuotedStringAddr()
 {
     Parser p = new Parser("\"Giant; \\\"Big\\\" Box\" <*****@*****.**>");
     Parser.Addresses addrs = p.parseMailboxOrGroup();
     int cnt = 0;
     foreach (Parser.Address addr in addrs.addresses())
         cnt++;
     Assert.AreEqual(1, cnt, "Expected one address");
     IEnumerator<Parser.Address> addresses = addrs.addresses().GetEnumerator();
     addresses.MoveNext();
     Parser.Address theaddr = addresses.Current;
     Assert.AreEqual("\"Giant; \"Big\" Box\" <*****@*****.**>", theaddr.name);
 }
Esempio n. 8
0
 public void TestMailboxWithQuotedName1()
 {
     Parser p = new Parser("\"Mary Smith: Personal Account\" <*****@*****.**>");
     Parser.Addresses addrs = p.parseMailboxOrGroup();
     int cnt = 0;
     foreach (Parser.Address addr in addrs.addresses())
         cnt++;
     Assert.AreEqual(1, cnt, "Expected one address");
     IEnumerator<Parser.Address> addresses = addrs.addresses().GetEnumerator();
     addresses.MoveNext();
     Parser.Address theaddr = addresses.Current;
     Assert.AreEqual("\"Mary Smith: Personal Account\" <*****@*****.**>", theaddr.name);
 }
Esempio n. 9
0
 public void TestMailboxWithQuestionMarkAddr()
 {
     Parser p = new Parser("Who? <*****@*****.**>");
     Parser.Addresses addrs = p.parseMailboxOrGroup();
     int cnt = 0;
     foreach (Parser.Address addr in addrs.addresses())
         cnt++;
     Assert.AreEqual(1, cnt, "Expected one address");
     IEnumerator<Parser.Address> addresses = addrs.addresses().GetEnumerator();
     addresses.MoveNext();
     Parser.Address theaddr = addresses.Current;
     Assert.AreEqual("Who? <*****@*****.**>", theaddr.name);
 }
Esempio n. 10
0
 public void TestMailboxWithCommentsInDisplayNameAndAngleAddr()
 {
     Parser p = new Parser("Pete(A nice \\) chap) <pete(his account)@silly.test(his host)>");
     Parser.Addresses addrs = p.parseMailboxOrGroup();
     int cnt = 0;
     foreach (Parser.Address addr in addrs.addresses())
         cnt++;
     Assert.AreEqual(1, cnt, "Expected one address");
     IEnumerator<Parser.Address> addresses = addrs.addresses().GetEnumerator();
     addresses.MoveNext();
     Parser.Address theaddr = addresses.Current;
     Assert.AreEqual("Pete <*****@*****.**>", theaddr.name);
 }