本文整理汇总了C#中System.Text.UnicodeEncoding.GetMaxCharCount方法的典型用法代码示例。如果您正苦于以下问题:C# UnicodeEncoding.GetMaxCharCount方法的具体用法?C# UnicodeEncoding.GetMaxCharCount怎么用?C# UnicodeEncoding.GetMaxCharCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Text.UnicodeEncoding
的用法示例。
在下文中一共展示了UnicodeEncoding.GetMaxCharCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PosTest2
public void PosTest2()
{
int expectedValue = 2;
int actualValue;
UnicodeEncoding uE = new UnicodeEncoding();
actualValue = uE.GetMaxCharCount(1);
Assert.Equal(expectedValue, actualValue);
}
示例2: NegTest1
public void NegTest1()
{
int actualValue;
UnicodeEncoding uE = new UnicodeEncoding();
Assert.Throws<ArgumentOutOfRangeException>(() =>
{
actualValue = uE.GetMaxCharCount(-1);
});
}
示例3: PosTest3
public void PosTest3()
{
int byteCount = _generator.GetInt32(-55);
int expectedValue = (byteCount + 1) / 2 + 1;
int actualValue;
UnicodeEncoding uE = new UnicodeEncoding();
actualValue = uE.GetMaxCharCount(byteCount);
Assert.Equal(expectedValue, actualValue);
}
示例4: TestMaxCharCount
public void TestMaxCharCount()
{
UnicodeEncoding UnicodeEnc = new UnicodeEncoding ();
#if NET_2_0
// where is this extra 1 coming from?
Assert.AreEqual (26, UnicodeEnc.GetMaxCharCount(50), "UTF #1");
Assert.AreEqual (27, UnicodeEnc.GetMaxCharCount(51), "UTF #2");
#else
Assert.AreEqual (25, UnicodeEnc.GetMaxCharCount(50), "UTF #1");
#endif
}
示例5: TestMaxCharCount
public void TestMaxCharCount()
{
UnicodeEncoding UnicodeEnc = new UnicodeEncoding ();
Assert.AreEqual (26, UnicodeEnc.GetMaxCharCount(50), "UTF #1");
Assert.AreEqual (27, UnicodeEnc.GetMaxCharCount(51), "UTF #2");
}
示例6: TestMaxCharCount
public void TestMaxCharCount()
{
UnicodeEncoding UnicodeEnc = new UnicodeEncoding ();
Assertion.AssertEquals ("UTF #1", 25, UnicodeEnc.GetMaxCharCount(50));
}