GetMaxCharCount() public method

public GetMaxCharCount ( int byteCount ) : int
byteCount int
return int
コード例 #1
0
        public void PosTest2()
        {
            int expectedValue = 2;
            int actualValue;
            UnicodeEncoding uE = new UnicodeEncoding();

            actualValue = uE.GetMaxCharCount(1);
            Assert.Equal(expectedValue, actualValue);
        }
コード例 #2
0
        public void NegTest1()
        {
            int actualValue;
            UnicodeEncoding uE = new UnicodeEncoding();

            Assert.Throws<ArgumentOutOfRangeException>(() =>
            {
                actualValue = uE.GetMaxCharCount(-1);
            });
        }
コード例 #3
0
        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
0
 static public int GetMaxCharCount(IntPtr l)
 {
     try {
         System.Text.UnicodeEncoding self = (System.Text.UnicodeEncoding)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         var ret = self.GetMaxCharCount(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #5
0
ファイル: UnicodeEncodingTest.cs プロジェクト: symform/mono
                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
                }
コード例 #6
0
 public void TestMaxCharCount()
 {
         UnicodeEncoding UnicodeEnc = new UnicodeEncoding ();
         Assert.AreEqual (26, UnicodeEnc.GetMaxCharCount(50), "UTF #1");
         Assert.AreEqual (27, UnicodeEnc.GetMaxCharCount(51), "UTF #2");
 }
コード例 #7
0
 public void TestMaxCharCount()
 {
         UnicodeEncoding UnicodeEnc = new UnicodeEncoding ();
         Assertion.AssertEquals ("UTF #1", 25, UnicodeEnc.GetMaxCharCount(50));
 }