示例#1
0
    public bool PosTest2()
    {
        bool   retVal = true;
        string strA;
        string ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest2: empty string ToString()");
        try
        {
            strA         = TestLibrary.Generator.GetString(-55, false, c_MINI_STRING_LENGTH, c_MAX_STRING_LENGTH);
            ActualResult = strA.ToString();
            char[] charStrA   = strA.ToCharArray();
            char[] charActual = ActualResult.ToCharArray();
            for (int i = 0; strA.Length > i; i++)
            {
                if (charStrA[i] != charActual[i])
                {
                    TestLibrary.TestFramework.LogError("001", "normal string ToString() ActualResult is not the ExpectResult");
                    retVal = false;
                    break;
                }
            }
            if (!object.ReferenceEquals(strA, ActualResult))
            {
                TestLibrary.TestFramework.LogError("002", "normal string ToString() ActualResult is not ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("003", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }