本文整理汇总了C#中Contact.AddContactEntry方法的典型用法代码示例。如果您正苦于以下问题:C# Contact.AddContactEntry方法的具体用法?C# Contact.AddContactEntry怎么用?C# Contact.AddContactEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact.AddContactEntry方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddContactEntry_EmailAndPhone_TwoEntries
public void AddContactEntry_EmailAndPhone_TwoEntries()
{
var contact = new Contact();
contact.AddContactEntry(new PhoneNumer("0702-937123"));
contact.AddContactEntry(new Email("[email protected]"));
var entries = contact.GetContactEntries();
Assert.That(entries, Has.Count.EqualTo(2));
}
示例2: AddContactEntry_InvalidPhone_NoEntry
public void AddContactEntry_InvalidPhone_NoEntry()
{
var contact = new Contact();
Assert.Throws<ArgumentException>(() => contact.AddContactEntry(new PhoneNumer("0702-9371ab")));
var entries = contact.GetContactEntries();
Assert.That(entries, Is.Empty);
}
示例3: AddContactEntry_InvalidEmail_NoEntry
public void AddContactEntry_InvalidEmail_NoEntry()
{
var contact = new Contact();
Assert.Throws<ArgumentException>(() => contact.AddContactEntry(new Email("invalid.email2gmail.com")));
var entries = contact.GetContactEntries();
Assert.That(entries, Is.Empty);
}
示例4: AddContactEntry_Email_OneEntry
public void AddContactEntry_Email_OneEntry()
{
var contact = new Contact();
contact.AddContactEntry(new Email("[email protected]"));
var entries = contact.GetContactEntries();
Assert.That(entries, Has.Count.EqualTo(1));
Assert.That(entries[0].Name, Is.EqualTo("Email"));
Assert.That(entries[0].Info, Is.EqualTo("[email protected]"));
}
示例5: AddContactEntry_AddPhoneNumber_OneEntry
public void AddContactEntry_AddPhoneNumber_OneEntry()
{
var contact = new Contact();
contact.AddContactEntry(new PhoneNumer("0702-937123"));
var entries = contact.GetContactEntries();
Assert.That(entries, Has.Count.EqualTo(1));
Assert.That(entries[0].Name, Is.EqualTo("Phone"));
Assert.That(entries[0].Info, Is.EqualTo("0702-937123"));
}