GetMaxByteCount() публичный Метод

public GetMaxByteCount ( int charCount ) : int
charCount int
Результат int
        public void PosTest2()
        {
            int expectedValue = 4;
            int actualValue;
            UnicodeEncoding uE = new UnicodeEncoding();

            actualValue = uE.GetMaxByteCount(1);
            Assert.Equal(expectedValue, actualValue);
        }
        public void NegTest2()
        {
            int actualValue;
            UnicodeEncoding uE = new UnicodeEncoding();

            Assert.Throws<ArgumentOutOfRangeException>(() =>
            {
                actualValue = uE.GetMaxByteCount(int.MaxValue / 2);
            });
        }
        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);
        }
 static public int GetMaxByteCount(IntPtr l)
 {
     try {
         System.Text.UnicodeEncoding self = (System.Text.UnicodeEncoding)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         var ret = self.GetMaxByteCount(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #5
0
                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
                }
Пример #6
0
 public void TestMaxByteCount()
 {
         UnicodeEncoding UnicodeEnc = new UnicodeEncoding ();
         Assert.AreEqual (102, UnicodeEnc.GetMaxByteCount(50), "UTF #1");
 }
 public void TestMaxByteCount()
 {
         UnicodeEncoding UnicodeEnc = new UnicodeEncoding ();
         Assertion.AssertEquals ("UTF #1", 100, UnicodeEnc.GetMaxByteCount(50));
 }