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