예제 #1
0
        public uint ToUInt32(IFormatProvider provider)
        {
            bool IsUInt32MinValue = true;

            if (provider != null)
            {
                TestIFormat iformat = (TestIFormat)provider.GetFormat(typeof(TestIFormat));
                if (iformat != null && iformat.IsUInt32MaxValue)
                {
                    IsUInt32MinValue = false;
                }
            }
            if (IsUInt32MinValue)
            {
                return(UInt32.MinValue);
            }
            else
            {
                return(UInt32.MaxValue);
            }
        }
예제 #2
0
    public bool PosTest3()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest3:Convert to UInt32 from object 3");
        try
        {
            object      objVal   = false;
            TestIFormat iformat  = new TestIFormat();
            uint        uintVal1 = Convert.ToUInt32(objVal, iformat);
            uint        uintVal2 = Convert.ToUInt32(objVal, null);
            if (uintVal1 != 0 || uintVal2 != 0)
            {
                TestLibrary.TestFramework.LogError("005", "the ExpectResult is not the ActualResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
예제 #3
0
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1:Convert to UInt32 from object 1");
        try
        {
            TestClass2  objVal   = new TestClass2();
            TestIFormat iformat  = new TestIFormat();
            uint        uintVal1 = Convert.ToUInt32(objVal, iformat);
            uint        uintVal2 = Convert.ToUInt32(objVal, null);
            if (uintVal1 != UInt32.MaxValue || uintVal2 != UInt32.MinValue)
            {
                TestLibrary.TestFramework.LogError("001", "the ExpectResult is not the ActualResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2:Convert to UInt16 from object 2");
        try
        {
            object      objVal      = true;
            TestIFormat iformat     = new TestIFormat();
            ushort      unshortVal1 = Convert.ToUInt16(objVal, iformat);
            ushort      unshortVal2 = Convert.ToUInt16(objVal, null);
            if (unshortVal1 != 1 || unshortVal2 != 1)
            {
                TestLibrary.TestFramework.LogError("003", "the ExpectResult is not the ActualResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
예제 #5
0
    public bool PosTest2()
    {
        bool retVal = true;
        TestLibrary.TestFramework.BeginScenario("PosTest2:Convert to UInt32 from object 2");
        try
        {
            object objVal = true;
            TestIFormat iformat = new TestIFormat();
            uint uintVal1 = Convert.ToUInt32(objVal, iformat);
            uint uintVal2 = Convert.ToUInt32(objVal, null);
            if (uintVal1 != 1 || uintVal2 != 1)
            {
                TestLibrary.TestFramework.LogError("003", "the ExpectResult is not the ActualResult");
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e);
            retVal = false;
        }
        return retVal;
    }
예제 #6
0
    public bool PosTest1()
    {
        bool retVal = true;
        TestLibrary.TestFramework.BeginScenario("PosTest1:Convert to UInt64 from object 1");
        try
        {
            TestClass2 objVal = new TestClass2();
            TestIFormat iformat = new TestIFormat();
            ulong ulongVal1 = Convert.ToUInt64(objVal, iformat);
            ulong ulongVal2 = Convert.ToUInt64(objVal, null);
            if (ulongVal1 != UInt64.MaxValue || ulongVal2 != UInt64.MinValue)
            {
                TestLibrary.TestFramework.LogError("001", "the ExpectResult is not the ActualResult");
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e);
            retVal = false;
        }
        return retVal;
    }
예제 #7
0
    public bool PosTest3()
    {
        bool retVal = true;
        TestLibrary.TestFramework.BeginScenario("PosTest3:Convert to UInt64 from object 3");
        try
        {
            object objVal = false;
            TestIFormat iformat = new TestIFormat();
            ulong ulongVal1 = Convert.ToUInt64(objVal, iformat);
            ulong ulongVal2 = Convert.ToUInt64(objVal, null);
            if (ulongVal1 != 0 || ulongVal2 != 0)
            {
                TestLibrary.TestFramework.LogError("005", "the ExpectResult is not the ActualResult");
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpect exception:" + e);
            retVal = false;
        }
        return retVal;
    }
예제 #8
0
    public bool PosTest4()
    {
        bool retVal = true;
        TestLibrary.TestFramework.BeginScenario("PosTest4:Convert to UInt16 from object 4");
        try
        {
            object objVal = null;
            TestIFormat iformat = new TestIFormat();
            ushort unshortVal1 = Convert.ToUInt16(objVal, iformat);
            ushort unshortVal2 = Convert.ToUInt16(objVal, null);
            if (unshortVal1 != 0 || unshortVal2 != 0)
            {
                TestLibrary.TestFramework.LogError("007", "the ExpectResult is not the ActualResult");
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("008", "Unexpect exception:" + e);
            retVal = false;
        }
        return retVal;
    }