本文整理汇总了C#中PhoneNumber.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# PhoneNumber.ToString方法的具体用法?C# PhoneNumber.ToString怎么用?C# PhoneNumber.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhoneNumber
的用法示例。
在下文中一共展示了PhoneNumber.ToString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NumericPhoneNumber
public void NumericPhoneNumber()
{
const string phoneNumber = "0100100";
sut = PhoneNumber.Create(phoneNumber);
Assert.AreEqual(phoneNumber, sut.ToString());
}
示例2: NumericPhoneNumberWithWhiteSpaces
public void NumericPhoneNumberWithWhiteSpaces()
{
const string phoneNumber = "02 588 4430";
sut = PhoneNumber.Create(phoneNumber);
Assert.AreEqual(phoneNumber, sut.ToString());
}
示例3: btAddPhoneNumber_Click
private void btAddPhoneNumber_Click(object sender, EventArgs e)
{
if (tbEditNumber.Text == "")
{
return;
}
PhoneNumber newNumber = new PhoneNumber(tbEditNumber.Text, lbLabels.SelectedItem.ToString());
lbNumbers.Items.Add(newNumber.ToString());
tbEditNumber.Text = "";
}
示例4: btEditNumber_Click
private void btEditNumber_Click(object sender, EventArgs e)
{
if (tbEditNumber.Text == "" || lbNumbers.SelectedItems.Count == 0)
{
return;
}
String phonenumber = lbNumbers.SelectedItem.ToString();
if (lbLabels.SelectedItems.Count == 0)
{
return;
}
lbNumbers.Items.RemoveAt(lbNumbers.SelectedIndex);
PhoneNumber newNumber = new PhoneNumber(tbEditNumber.Text, lbLabels.SelectedItem.ToString());
lbNumbers.Items.Add(newNumber.ToString());
tbEditNumber.Text = "";
}
示例5: Print
public void Print()
{
var number = new PhoneNumber("1-878-443-2908 ext. 23");
Assert.AreEqual("1-878-443-2908x23", number.ToString());
number = new PhoneNumber("6048537994");
Assert.AreEqual("6048537994", number.ToString());
number = new PhoneNumber("-604-5527455x");
Assert.AreEqual("604-5527455", number.ToString());
// test for manually set values
number = new PhoneNumber {
Country = null,
Area = null,
Local = "12346",
Extension = null
};
Assert.AreEqual("12346", number.ToString());
}
示例6: ToStringReturnsValue
public void ToStringReturnsValue()
{
var phoneNumber = new PhoneNumber("01234 567890");
Assert.Equal("01234 567890", phoneNumber.ToString());
}
示例7: TestToString
public void TestToString()
{
var phone = new PhoneNumber("2055551212");
Assert.AreEqual("2055551212", phone.ToString());
}
示例8: Formats_a_number
public void Formats_a_number()
{
var phone = new PhoneNumber("1234567890");
Assert.That(phone.ToString(), Is.EqualTo("(123) 456-7890"));
}
示例9: LandLineNumberWithCountryPrefix
public void LandLineNumberWithCountryPrefix()
{
const string phoneNumber = "+358 9 451 4319";
sut = PhoneNumber.Create(phoneNumber);
Assert.AreEqual(phoneNumber, sut.ToString());
}
示例10: CellPhoneNumberWithCountryPrefix
public void CellPhoneNumberWithCountryPrefix()
{
const string phoneNumber = "+35850 123 4567";
sut = PhoneNumber.Create(phoneNumber);
Assert.AreEqual(phoneNumber, sut.ToString());
}
示例11: CellPhoneNumberWithLine
public void CellPhoneNumberWithLine()
{
const string phoneNumber = "050-1234567";
sut = PhoneNumber.Create(phoneNumber);
Assert.AreEqual(phoneNumber, sut.ToString());
}
示例12: PhoneNumberWithManyNumbersBeforeTheFirstWhiteSpace
public void PhoneNumberWithManyNumbersBeforeTheFirstWhiteSpace()
{
const string phoneNumber = "0295 50 3000";
sut = PhoneNumber.Create(phoneNumber);
Assert.AreEqual(phoneNumber, sut.ToString());
}
示例13: PhoneNumber_Unit_ToString_Optimal
public void PhoneNumber_Unit_ToString_Optimal()
{
String countryCode = "1";
String areaCode = "800";
String[] subscriberNumberGroups = new String[] { "abc", "defg" };
PhoneNumber target = new PhoneNumber(countryCode, areaCode, subscriberNumberGroups);
String expected = new String[] { countryCode, areaCode }.Concat(subscriberNumberGroups).ToArray().Join(' ');
String actual = target.ToString();
Assert.AreEqual(expected, actual);
}