public void MailMergeAddressCollectionEquality() { var addrColl1 = new MailMergeAddressCollection { _addr1a, _addr2a }; var addrColl2 = new MailMergeAddressCollection { _addr2b, _addr1b }; var addrColl1_Ref = addrColl1; Assert.True(addrColl1.Equals(addrColl2)); Assert.True(addrColl1.Equals(addrColl1_Ref)); Assert.False(addrColl1.Equals(_addr1a)); addrColl2.Add(_addr3); Assert.False(addrColl1.Equals(addrColl2)); Assert.False(addrColl1.Equals(null)); }
public void MailMergeAddresses() { var addr1a = new MailMergeAddress(MailAddressType.To, "diplay name", "*****@*****.**") { DisplayNameCharacterEncoding = Encoding.UTF32 }; var addr2a = new MailMergeAddress(MailAddressType.To, "diplay name", "*****@*****.**") { DisplayNameCharacterEncoding = Encoding.UTF32 }; var addr3 = new MailMergeAddress(MailAddressType.To, "diplay name 3", "*****@*****.**") { DisplayNameCharacterEncoding = Encoding.UTF8 }; var addr1b = new MailMergeAddress(MailAddressType.To, "diplay name", "*****@*****.**") { DisplayNameCharacterEncoding = Encoding.UTF32 }; var addr2b = new MailMergeAddress(MailAddressType.To, "diplay name", "*****@*****.**") { DisplayNameCharacterEncoding = Encoding.UTF32 }; Assert.True(addr1a.Equals(addr2a)); Assert.False(addr1a.Equals(addr3)); var addrColl1 = new MailMergeAddressCollection { addr1a, addr2a }; var addrColl2 = new MailMergeAddressCollection { addr2b, addr1b }; Assert.True(addrColl1.Equals(addrColl2)); addrColl2.Add(addr3); Assert.False(addrColl1.Equals(addrColl2)); }