Ejemplo n.º 1
0
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: Call SafeHandle.SetHandleAsInvalid ");
        try
        {
            MySafeHandle msh    = new MySafeHandle();
            IntPtr       myIptr = new IntPtr(1000);
            msh.MySetHandle(myIptr);
            msh.SetHandleAsInvalid();
            if (!msh.IsClosed || msh.GetHandle() != myIptr)
            {
                TestLibrary.TestFramework.LogError("001.1", "SetHandleAsInvalid has error ");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: Call SafeHandle.SetHandleAsInvalid ");
        try
        {
            MySafeHandle msh = new MySafeHandle();
            IntPtr myIptr = new IntPtr(1000);
            msh.MySetHandle(myIptr);
            msh.SetHandleAsInvalid();
            if (!msh.IsClosed || msh.GetHandle()!=myIptr )
            {
                TestLibrary.TestFramework.LogError("001.1", "SetHandleAsInvalid has error ");
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
Ejemplo n.º 3
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Check IsClosed return false when SetHandleAsInvalid method is not called and don't excute any close handle operation  ");
        try
        {
            MySafeHandle msh = new MySafeHandle();
            IntPtr myIptr = new IntPtr(1000);
            msh.MySetHandle(myIptr);
            if (msh.IsClosed)
            {
                TestLibrary.TestFramework.LogError("002.1", "IsClosed should return false ");
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
Ejemplo n.º 4
0
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: Check IsClosed return true when SetHandleAsInvalid method is called  ");
        try
        {
            MySafeHandle msh = new MySafeHandle();
            IntPtr myIptr = new IntPtr(1000);
            msh.MySetHandle(myIptr);
            msh.SetHandleAsInvalid();
            if (!msh.IsClosed )
            {
                TestLibrary.TestFramework.LogError("001.1", "IsClosed should return true");
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
Ejemplo n.º 5
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Check IsClosed return false when SetHandleAsInvalid method is not called and don't excute any close handle operation  ");
        try
        {
            MySafeHandle msh    = new MySafeHandle();
            IntPtr       myIptr = new IntPtr(1000);
            msh.MySetHandle(myIptr);
            if (msh.IsClosed)
            {
                TestLibrary.TestFramework.LogError("002.1", "IsClosed should return false ");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
Ejemplo n.º 6
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Check IsInvalid return false when  the handle value is Released. ");
        try
        {
            MySafeHandle msh    = new MySafeHandle();
            IntPtr       myIptr = new IntPtr(1000);
            msh.MySetHandle(myIptr);
            msh.MyReleaseInvoke();
            if (msh.IsInvalid)
            {
                TestLibrary.TestFramework.LogError("002.1", "IsInvalid should return false ");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
Ejemplo n.º 7
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Check IsInvalid return false when  the handle value is Released. ");
        try
        {
            MySafeHandle msh = new MySafeHandle();
            IntPtr myIptr = new IntPtr(1000);
            msh.MySetHandle(myIptr);
            msh.MyReleaseInvoke();
            if (msh.IsInvalid)
            {
                TestLibrary.TestFramework.LogError("002.1", "IsInvalid should return false ");
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }