예제 #1
0
 public bool runTest()
 {
     Console.WriteLine(s_strTFPath + "\\" + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
     try
     {
         Boolean testSubject  = false;
         SByte[] testSubjects = new SByte[] {
             SByte.MinValue,
             SByte.MaxValue,
             (SByte)(-5),
             (SByte)(-6),
             (SByte)(-10),
             (SByte)(5),
             (SByte)(44),
             (SByte)(127),
             (SByte)(-100),
         };
         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 = false;
         TypeCode t1 = testSubject.GetTypeCode();
         iCountTestcases++;
         if (t1 != TypeCode.Boolean)
         {
             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);
     }
 }
예제 #2
0
    // Test the GetTypeCode method
    public void TestBooleanGetTypeCode()
    {
        Boolean boolean = true;

        AssertEquals("GetTypeCode failed", TypeCode.Boolean, boolean.GetTypeCode());
    }
        public void GetTypeCode()
        {
            Boolean b = true;

            Assert.AreEqual(TypeCode.Boolean, b.GetTypeCode(), "GetTypeCode failed");
        }