public bool runTest()
    {
        Console.WriteLine(s_strTFPath + "\\" + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
        String strLoc          = "Loc_000oo";
        String strValue        = String.Empty;
        int    iCountErrors    = 0;
        int    iCountTestcases = 0;

        try
        {
            TypeCode ReturnValue;
            strLoc = "Loc_400vy";
            UInt32 test = 0;
            iCountTestcases++;
            ReturnValue = test.GetTypeCode();
            if (ReturnValue != TypeCode.UInt32)
            {
                ++iCountErrors;
                printerr("Error_100aa! Expected==TypeCode.UInt32 Value==" + ReturnValue);
            }
        } catch (Exception exc_general) {
            ++iCountErrors;
            Console.WriteLine(s_strTFAbbrev + " : Error Err_8888yyy!  strLoc==" + strLoc + ", exc_general==" + exc_general.ToString());
        }
        if (iCountErrors == 0)
        {
            Console.WriteLine("paSs. " + s_strTFName + " ,iCountTestcases==" + iCountTestcases.ToString());
            return(true);
        }
        else
        {
            Console.WriteLine("FAiL! " + s_strTFName + " ,iCountErrors==" + iCountErrors.ToString() + " , BugNums?: " + s_strActiveBugNums);
            return(false);
        }
    }
        public void Test_Serialize_UInt32()
        {
            var    transcoder = new DefaultTranscoder(new ManualByteConverter());
            UInt32 data       = 9;

            var flags = new Flags
            {
                Compression = Compression.None,
                DataFormat  = DataFormat.Reserved,
                TypeCode    = data.GetTypeCode()
            };

            var expected = new byte[] { 0x00, 0x00, 0x00, 0x09 };
            var actual   = transcoder.Encode(data, flags);

            Assert.AreEqual(expected, actual);
        }
예제 #3
0
 public bool runTest()
 {
     Console.WriteLine(s_strTFPath + "\\" + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
     try
     {
         UInt32   testSubject  = (UInt32)5;
         UInt32[] testSubjects = new UInt32[] {
             UInt32.MinValue,
             UInt32.MaxValue,
             (UInt32)(5),
             (UInt32)(0),
             (UInt32)(4),
             (UInt32)(333),
             (UInt32)(1000),
             (UInt32)(3333333)
         };
         Type[] typecodes =
         {
             typeof(Object),
             typeof(DBNull),
             typeof(Boolean),
             typeof(Char),
             typeof(SByte),
             typeof(Byte),
             typeof(Int16),
             typeof(UInt16),
             typeof(Int32),
             typeof(UInt32),
             typeof(Int64),
             typeof(UInt64),
             typeof(Single),
             typeof(Double),
             typeof(Decimal),
             typeof(DateTime),
             typeof(String)
         };
         strLoc      = "Loc_2y8f8";
         testSubject = (UInt32)5;
         TypeCode t1 = testSubject.GetTypeCode();
         iCountTestcases++;
         if (t1 != TypeCode.UInt32)
         {
             iCountErrors++;
             printerr("Error_298yv! Incorrect typecode returned");
         }
         strLoc = "Loc_498yg";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToBoolean(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_248v8! ToBoolean failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49800";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToChar(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_r8955! ToChar failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49801";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToSByte(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_39r8r! ToSByte failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49802";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToByte(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_298d8! ToByte failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49803";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToInt16(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_20989! ToInt16 failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49804";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToUInt16(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_r498d! ToUInt16 failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49805";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToInt32(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_r4988! ToInt32 failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49806";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToUInt32(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_20992! ToUInt32 failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49807";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToInt64(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_398w8! ToInt64 failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49808";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToUInt64(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_e3298! ToUInt64 failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49809";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToSingle(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_2099s! ToSingle failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49810";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToDouble(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_9848r! ToDouble failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49811";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToDecimal(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_398s9! ToDecimal failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49812";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToDateTime(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_20999! ToDateTime failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49813";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             iCountTestcases++;
             if (!TestToString(testSubjects[i]))
             {
                 iCountErrors++;
                 printerr("Error_298s4! ToString failed==" + testSubjects[i]);
             }
         }
         strLoc = "Loc_49814";
         for (int i = 0; i < testSubjects.Length; i++)
         {
             for (int j = 0; j < typecodes.Length; j++)
             {
                 iCountTestcases++;
                 if (!TestToType(testSubjects[i], typecodes[j]))
                 {
                     iCountErrors++;
                     printerr("Error_29888! ToType failed==" + testSubjects[i]);
                 }
             }
         }
     }
     catch (Exception exc_general)
     {
         ++iCountErrors;
         Console.WriteLine(s_strTFAbbrev + " : Error Err_8888yyy!  strLoc==" + strLoc + ", exc_general==" + exc_general.ToString());
     }
     if (iCountErrors == 0)
     {
         Console.WriteLine("paSs. " + s_strTFName + " ,iCountTestcases==" + iCountTestcases.ToString());
         return(true);
     }
     else
     {
         Console.WriteLine("FAiL! " + s_strTFName + " ,iCountErrors==" + iCountErrors.ToString() + " , BugNums?: " + s_strActiveBugNums);
         return(false);
     }
 }