Example #1
0
    public bool PosTest2()
    {
        bool   retVal = true;
        string errorDesc;

        UInt16 uintA;
        string expectedValue;
        string actualValue;

        uintA = UInt16.MaxValue;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Value is UInt16.MaxValue.");
        try
        {
            actualValue   = uintA.ToString();
            expectedValue = GlobLocHelper.OSUInt16ToString(uintA);

            if (actualValue != expectedValue)
            {
                errorDesc =
                    string.Format("The char value of {0} is not the value {1} as expected: actual({2})",
                                  uintA, expectedValue, actualValue);
                TestLibrary.TestFramework.LogError("003", errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpect exception:" + e;
            TestLibrary.TestFramework.LogError("004", errorDesc);
            retVal = false;
        }
        return(retVal);
    }
Example #2
0
    public bool PosTest1()
    {
        bool   retVal = true;
        string errorDesc;

        UInt16 uintA;
        string expectedValue;
        string actualValue;

        uintA = (UInt16)(TestLibrary.Generator.GetInt32(-55) % (UInt16.MaxValue + 1));

        TestLibrary.TestFramework.BeginScenario("PosTest1: Random UInt16 value between 0 and UInt16.MaxValue.");
        try
        {
            actualValue   = uintA.ToString();
            expectedValue = GlobLocHelper.OSUInt16ToString(uintA);

            if (actualValue != expectedValue)
            {
                errorDesc =
                    string.Format("The char value of {0} is not the value {1} as expected: actual({2})",
                                  uintA, expectedValue, actualValue);
                TestLibrary.TestFramework.LogError("001", errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpect exception:" + e;
            TestLibrary.TestFramework.LogError("002", errorDesc);
            retVal = false;
        }
        return(retVal);
    }
Example #3
0
    public bool DoPosTest(string testDesc,
                          string errorNum1,
                          string errorNum2,
                          UInt16 uintA,
                          CultureInfo culture)
    {
        bool   retVal = true;
        string errorDesc;

        IFormatProvider provider;
        string          expectedValue;
        string          actualValue;

        TestLibrary.TestFramework.BeginScenario(testDesc);
        try
        {
            provider = (IFormatProvider)culture.NumberFormat;

            actualValue   = uintA.ToString(provider);
            expectedValue = GlobLocHelper.OSUInt16ToString(uintA, culture);

            if (actualValue != expectedValue)
            {
                errorDesc =
                    string.Format("The string representation of {0} is not the value {1} as expected: actual({2})",
                                  uintA, expectedValue, actualValue);
                errorDesc += "\nThe format info is " + culture.Name + " culture speicifed.";
                TestLibrary.TestFramework.LogError("005", errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpect exception:" + e;
            TestLibrary.TestFramework.LogError("006", errorDesc);
            retVal = false;
        }
        return(retVal);
    }