Example #1
0
    public static void TestEquals()
    {
        UInt16 i = 911;

        Assert.True(i.Equals((UInt16)911));
        Assert.True(!i.Equals((UInt16)0));
    }
Example #2
0
 public void TestEquals()
 {
     Assert.IsTrue(MyUInt16_1.Equals(MyUInt16_1));
     Assert.IsTrue(MyUInt16_1.Equals((object)(UInt16)(42)));
     Assert.IsTrue(MyUInt16_1.Equals((object)(SByte)(42)) == false);
     Assert.IsTrue(MyUInt16_1.Equals(MyUInt16_2) == false);
 }
Example #3
0
    public static void TestEqualsObject()
    {
        UInt16 i = 789;

        object obj1 = (UInt16)789;

        Assert.True(i.Equals(obj1));

        object obj3 = (UInt16)0;

        Assert.True(!i.Equals(obj3));
    }
Example #4
0
    public bool PosTest3()
    {
        bool retVal = true;
        bool ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest3: UInt32 value is different from the instance 2");
        try
        {
            UInt16 intA     = (UInt16)this.GetInt32(0, UInt16.MaxValue);
            UInt16 uintA    = (UInt16)(intA + 1);
            UInt16 comValue = (UInt16)intA;
            ActualResult = uintA.Equals(comValue);
            if (ActualResult)
            {
                TestLibrary.TestFramework.LogError("005", "the ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #5
0
        private static bool VerifyUInt16ImplicitCastToBigInteger(UInt16 value)
        {
            bool       ret = true;
            BigInteger bigInteger;

            bigInteger = value;

            ret &= Eval(bigInteger.Equals(value), String.Format("Expected BigInteger {0} to be equal to UInt16 {1}", bigInteger, value));
            ret &= Eval(value.ToString(), bigInteger.ToString(), "UInt16.ToString() and BigInteger.ToString()");
            ret &= Eval(value, (UInt16)bigInteger, "Round tripped UInt16");

            if (value != UInt16.MaxValue)
            {
                ret &= Eval((UInt16)(value + 1), (UInt16)(bigInteger + 1), "BigInteger added to 1");
            }

            if (value != UInt16.MinValue)
            {
                ret &= Eval((UInt16)(value - 1), (UInt16)(bigInteger - 1), "BigInteger subtracted by 1");
            }

            ret &= VerifyBigintegerUsingIdentities(bigInteger, 0 == value);

            return(ret);
        }
Example #6
0
    public static void Main()
    {
        try
        {
// <Snippet1>
            UInt16 myVariable1 = 10;
            UInt16 myVariable2 = 10;

            //Display the declaring type.
            Console.WriteLine("\nType of 'myVariable1' is '{0}' and" +
                              " value is :{1}", myVariable1.GetType(), myVariable1);
            Console.WriteLine("Type of 'myVariable2' is '{0}' and" +
                              " value is :{1}", myVariable2.GetType(), myVariable2);

            // Compare 'myVariable1' instance with 'myVariable2' Object.
            if (myVariable1.Equals(myVariable2))
            {
                Console.WriteLine("\nStructures 'myVariable1' and " +
                                  "'myVariable2' are equal");
            }
            else
            {
                Console.WriteLine("\nStructures 'myVariable1' and " +
                                  "'myVariable2' are not equal");
            }

// </Snippet1>
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception :{0}", e.Message);
        }
    }
        public string getInformation()
        {
            string returnsValue = "";

            try
            {
                this.ObjQuery.QueryString = "SELECT * FROM Win32_NetworkAdapter";
                this.ObjSearcher.Query    = this.ObjQuery;
                foreach (ManagementObject obj in this.ObjSearcher.Get())
                {
                    try
                    {
                        //
                        UInt16 tmp = UInt16.Parse(obj.GetPropertyValue("AdapterTypeID").ToString());
                        if (tmp.Equals(0))//ethernet 802.3 (ini adalah local area network) || wireless (card)
                        {
                            if (obj.GetPropertyValue("ProductName").ToString().ToLower().Contains("virtualbox") || obj.GetPropertyValue("PNPDeviceID").ToString().ToLower().Contains("root\\") || obj.GetPropertyValue("Manufacturer").ToString().ToLower().Contains("microsoft"))
                            {
                                continue;
                            }
                            else
                            {
                                string productName  = obj.GetPropertyValue("ProductName").ToString();
                                string manufacturer = obj.GetPropertyValue("Manufacturer").ToString();
                                string macAddress   = obj.GetPropertyValue("MacAddress").ToString();
                                string IpAddress    = this.getIpaddress(macAddress).ToString();
                                if (string.IsNullOrEmpty(productName))
                                {
                                    productName = "Nama Product Tidak di temukan";
                                }
                                if (string.IsNullOrEmpty(manufacturer))
                                {
                                    manufacturer = "Brand tidak di temukan";
                                }
                                if (string.IsNullOrEmpty(macAddress))
                                {
                                    macAddress = "Mac Address Tidak Di temukan";
                                }
                                if (string.IsNullOrEmpty(IpAddress))
                                {
                                    IpAddress = "Ip Address Tidak di temukan";
                                }
                                returnsValue += ("*" + productName + "*" + manufacturer + "*" + macAddress + "*" + IpAddress + "*");
                                returnsValue += "@";
                            }
                        }
                    }
                    catch (Exception) {
                        returnsValue += "@";
                        continue;
                    }
                }
                return(returnsValue);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #8
0
    public override bool Equals(object obj)
    {
        if (obj is CanSourceId)
        {
            return(_Value.Equals((obj as CanSourceId)._Value));
        }

        return(base.Equals(obj));
    }
Example #9
0
        /// <summary>
        /// Compares two instances of this object.
        /// </summary>
        /// <param name="IPPort">An object to compare with.</param>
        /// <returns>true|false</returns>
        public Boolean Equals(IPPort IPPort)
        {
            if ((Object)IPPort == null)
            {
                throw new ArgumentNullException("The given IPPort must not be null!");
            }

            return(_IPPort.Equals(IPPort._IPPort));
        }
Example #10
0
 public override bool Equals(object obj)
 {
     if (obj is CoreInteger)
     {
         var ci = obj as CoreInteger;
         return(Value.Equals(ci.Value));
     }
     return(false);
 }
Example #11
0
        /// <summary>
        /// Compares two HourMins for equality.
        /// </summary>
        /// <param name="HourMin">A HourMin to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public Boolean Equals(HourMin HourMin)
        {
            if ((Object)HourMin == null)
            {
                return(false);
            }

            return(_Hour.Equals(HourMin._Hour) &&
                   _Minute.Equals(HourMin._Minute));
        }
Example #12
0
        override public Object Get(int record)
        {
            UInt16 value = values[record];

            if (!value.Equals(defaultValue))
            {
                return(value);
            }
            return(GetBits(record));
        }
Example #13
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object" /> is equal to this <see cref="SecsUInt16"/> instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this <see cref="SecsUInt16"/> instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this <see cref="SecsUInt16"/> instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (obj == null || !(obj is SecsUInt16))
            {
                return(false);
            }

            SecsUInt16 sobj = obj as SecsUInt16;

            return(_value.Equals(sobj._value));
        }
Example #14
0
        private void MethodTests()
        {
            featureTest.FailureMessage = "\tFailed UInt16 Method Test";
            featureTest.Send("UInt16 Method Test");
            UInt16 value1 = 1;
            UInt16 value2 = 2;
            UInt16 value3 = 3;
            Object obj1   = value1;
            Object obj2   = value2;
            Object obj3   = value3;

            featureTest.AssertTrue(value2.CompareTo(value1) > 0);
            featureTest.AssertTrue(value2.CompareTo(value3) < 0);
            featureTest.AssertTrue(value2.CompareTo(value2) == 0);

            featureTest.AssertTrue(value2.CompareTo(obj1) > 0);
            featureTest.AssertTrue(value2.CompareTo(obj3) < 0);
            featureTest.AssertTrue(value2.CompareTo(obj2) == 0);

            featureTest.AssertTrue(!value2.Equals(value1));
            featureTest.AssertTrue(!value2.Equals(value3));
            featureTest.AssertTrue(value2.Equals(value2));

            featureTest.AssertTrue(!value2.Equals(obj1));
            featureTest.AssertTrue(!value2.Equals(obj3));
            featureTest.AssertTrue(value2.Equals(obj2));
            featureTest.AssertTrue(UInt16.Parse("33") == 33);
            String str = 35.ToString();

            featureTest.AssertTrue(str == "35");
            UInt16 parsed;

            featureTest.AssertTrue(UInt16.TryParse(str, out parsed));
            featureTest.AssertTrue(parsed == 35);
        }
Example #15
0
 public bool Equals(SynProxyModule other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Mss.Equals(other.Mss) && Wscale.Equals(other.Wscale) &&
            Sack.Equals(other.Sack) && Timestamp.Equals(other.Timestamp));
 }
Example #16
0
            public override bool Equals(object obj)
            {
                if (obj == this)
                {
                    return(true);
                }
                if (!(obj is Item))
                {
                    return(false);
                }
                Item other = (Item)obj;

                return((other._ushort == _ushort) && _ushortWrapper.Equals(other._ushortWrapper
                                                                           ));
            }
Example #17
0
        private bool Checksum()
        {
            UInt16 sumCalulated   = 0;
            int    dataStartIndex = 0 + BeginBytes.Length;
            int    dataEndIndex   = PackageLength - EndBytes.Length - sizeof(UInt16);

            for (int i = dataStartIndex; i < dataEndIndex; i++)
            {
                sumCalulated += (UInt16)InBuffer[i];
            }

            byte[] checksumBytes = new byte[sizeof(UInt16)];
            Buffer.BlockCopy(InBuffer, dataEndIndex, checksumBytes, 0, sizeof(UInt16));

            UInt16 sumReceived = (UInt16)BitConverter.ToInt16(checksumBytes, 0);

            return(sumCalulated.Equals(sumReceived));
        }
Example #18
0
    public bool PosTest1()
    {
        bool retVal = true;
        bool ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest1: UInt16 value is zero");
        try
        {
            UInt16 uintA    = (UInt16)this.GetInt32(1, UInt16.MaxValue);
            UInt16 comValue = 0;
            ActualResult = uintA.Equals(comValue);
            if (ActualResult)
            {
                TestLibrary.TestFramework.LogError("001", "the ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #19
0
    public bool PosTest5()
    {
        bool retVal = true;
        bool ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest5: object and the instance have the same type and the same value 2");
        try
        {
            UInt16 uintA    = 0;
            UInt16 comValue = UInt16.MinValue;
            ActualResult = uintA.Equals(comValue);
            if (!ActualResult)
            {
                TestLibrary.TestFramework.LogError("009", "the ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("010", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #20
0
    public bool PosTest4()
    {
        bool retVal = true;
        bool ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest4: UInt32 value is equal the instance ");
        try
        {
            UInt16 uintA    = 0xffff;
            UInt16 comValue = UInt16.MaxValue;
            ActualResult = uintA.Equals(comValue);
            if (!ActualResult)
            {
                TestLibrary.TestFramework.LogError("007", "the ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("008", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #21
0
    public bool PosTest2()
    {
        bool retVal = true;
        bool ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest2: object value is declaring class");
        try
        {
            UInt16 uintA    = (UInt16)this.GetInt32(0, UInt16.MaxValue);
            object comValue = new MyTest();
            ActualResult = uintA.Equals(comValue);
            if (ActualResult)
            {
                TestLibrary.TestFramework.LogError("003", "the ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #22
0
    public bool PosTest3()
    {
        bool retVal = true;
        bool ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest3: object value is the instance value but the types are different");
        try
        {
            Int16  comValue = TestLibrary.Generator.GetInt16(-55);
            UInt16 uintA    = (UInt16)comValue;
            ActualResult = uintA.Equals(comValue);
            if (ActualResult)
            {
                TestLibrary.TestFramework.LogError("005", "the ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #23
0
 public override bool Equals(pfSDSCItem other)
 {
     return(value.Equals(other.value));
 }
Example #24
0
 public override bool Equals(ushort x, ushort y)
 {
     return(UInt16.Equals(x, y));
 }
Example #25
0
 public override bool Equals(object other)
 {
     return(ReferenceEquals(other, null) && !hasValue ||
            value.Equals(other));
 }
Example #26
0
    public Boolean runTest()
    {
        Console.WriteLine(s_strTFPath + " " + s_strTFName + " ,for " + s_strComponentBeingTested + "  ,Source ver " + s_strDtTmVer);
        String strBaseLoc;

        try
        {
            m_strLoc = "Loc_normalTests";
            UInt16 primativeUIntA = 100;
            UInt16 primativeUIntB = 200;
            UInt16 testUIntA      = ((UInt16)primativeUIntA);
            UInt16 testUIntAA     = ((UInt16)primativeUIntA);
            UInt16 testUIntB      = ((UInt16)primativeUIntB);
            iCountTestcases++;
            try {
                m_strLoc = "Starting testcase #" + iCountTestcases;
                m_strLoc = m_strLoc + "Equals self";
                if (testUIntA.Equals(testUIntA) != true)
                {
                    ErrorCode();
                }
            } catch (Exception e) {
                iCountErrors++;
                Console.WriteLine("Testcase[" + iCountTestcases + "]");
                Console.WriteLine("Exception:" + e);
                Console.WriteLine("StrLoc = '" + m_strLoc + "'");
            }
            iCountTestcases++;
            try {
                m_strLoc = "Starting testcase #" + iCountTestcases;
                m_strLoc = m_strLoc + "Equals same value";
                if (testUIntA.Equals(testUIntAA) != true)
                {
                    ErrorCode();
                }
            } catch (Exception e) {
                iCountErrors++;
                Console.WriteLine("Testcase[" + iCountTestcases + "]");
                Console.WriteLine("Exception:" + e);
                Console.WriteLine("StrLoc = '" + m_strLoc + "'");
            }
            iCountTestcases++;
            try {
                m_strLoc = "Starting testcase #" + iCountTestcases;
                m_strLoc = m_strLoc + "Equals diff value";
                if (testUIntA.Equals(testUIntB) == true)
                {
                    ErrorCode();
                }
            } catch (Exception e) {
                iCountErrors++;
                Console.WriteLine("Testcase[" + iCountTestcases + "]");
                Console.WriteLine("Exception:" + e);
                Console.WriteLine("StrLoc = '" + m_strLoc + "'");
            }
            iCountTestcases++;
            try {
                m_strLoc = "Starting testcase #" + iCountTestcases;
                m_strLoc = m_strLoc + "Equals primative UInt16";
                if (testUIntA.Equals(primativeUIntA) != true)
                {
                    ErrorCode();
                }
            } catch (Exception e) {
                iCountErrors++;
                Console.WriteLine("Testcase[" + iCountTestcases + "]");
                Console.WriteLine("Exception:" + e);
                Console.WriteLine("StrLoc = '" + m_strLoc + "'");
            }
            iCountTestcases++;
            try {
                m_strLoc = "Starting testcase #" + iCountTestcases;
                m_strLoc = m_strLoc + "Equals string 100";
                if (testUIntA.Equals("100") == true)
                {
                    ErrorCode();
                }
            } catch (Exception e) {
                iCountErrors++;
                Console.WriteLine("Testcase[" + iCountTestcases + "]");
                Console.WriteLine("Exception:" + e);
                Console.WriteLine("StrLoc = '" + m_strLoc + "'");
            }
            iCountTestcases++;
            try {
                m_strLoc = "Starting testcase #" + iCountTestcases;
                m_strLoc = m_strLoc + "Equals new Unsigned Short same val";
                if (testUIntA.Equals(((UInt16)primativeUIntA)) != true)
                {
                    ErrorCode();
                }
            } catch (Exception e) {
                iCountErrors++;
                Console.WriteLine("Testcase[" + iCountTestcases + "]");
                Console.WriteLine("Exception:" + e);
                Console.WriteLine("StrLoc = '" + m_strLoc + "'");
            }
        }
        catch (Exception exc_general)
        {
            ++iCountErrors;
            Console.WriteLine("Error Err_8888yyy (" + s_strTFAbbrev + ")!  Unexpected exception thrown sometime after m_strLoc==" + m_strLoc + " ,exc_general==" + exc_general);
        }
        Console.Write(Environment.NewLine);
        Console.WriteLine("Total Tests Ran: " + iCountTestcases + " Failed Tests: " + iCountErrors);
        if (iCountErrors == 0)
        {
            Console.WriteLine("paSs.   " + s_strTFPath + " " + s_strTFName + "  ,iCountTestcases==" + iCountTestcases);
            return(true);
        }
        else
        {
            Console.WriteLine("FAiL!   " + s_strTFPath + " " + s_strTFName + "  ,iCountErrors==" + iCountErrors + " ,BugNums?: " + s_strActiveBugNums);
            return(false);
        }
    }
    public Boolean runTest()
    {
        Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " ,for " + s_strClassMethod + "  ,Source ver " + s_strDtTmVer);
        String strLoc          = "Loc_000oo";
        int    iCountTestcases = 0;
        int    iCountErrors    = 0;

        printoutCoveredMethods();
        if (verbose)
        {
            Console.WriteLine("Testing Method: Boolean");
        }
        try {
            Boolean[] testValues =
            {
                true,
                false,
            };
            UInt16[] expectedValues =
            {
                1,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vboolAr," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xboolAr," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
        } catch (Exception e) {
            Console.WriteLine("Uncaught Exception in UInt16 Convert.ToUInt16( Boolean )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Double");
        }
        try {
            Double[] testValues =
            {
                1000.0,
                0.0,
            };
            UInt16[] expectedValues =
            {
                1000,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vdoubAr," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xdoubAr," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
                "System.OverflowException",
            };
            Double[] errorValues =
            {
                Double.MaxValue,
                -100.0,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i]);
                    iCountErrors++;
                    strLoc = "Err_EXdoubArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXdoubArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            Console.WriteLine("Uncaught Exception in UInt16 Convert.ToUInt16( Double )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Single");
        }
        try {
            Single[] testValues =
            {
                1000.0f,
                0.0f,
            };
            UInt16[] expectedValues =
            {
                1000,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vsingAr," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xsingAr," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
                "System.OverflowException",
            };
            Single[] errorValues =
            {
                Single.MaxValue,
                -100.0f,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i]);
                    iCountErrors++;
                    strLoc = "Err_EXsingArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXsingArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            Console.WriteLine("Uncaught Exception in UInt16 Convert.ToUInt16( Single )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Int32");
        }
        try {
            Int32[] testValues =
            {
                1000,
                0,
            };
            UInt16[] expectedValues =
            {
                1000,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vint3Ar," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xint3Ar," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
                "System.OverflowException",
            };
            Int32[] errorValues =
            {
                Int32.MinValue,
                Int32.MaxValue,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i]);
                    iCountErrors++;
                    strLoc = "Err_EXint3ArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXint3ArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            Console.WriteLine("Uncaught Exception in UInt16 Convert.ToUInt16( Int32 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Int64");
        }
        try {
            Int64[] testValues =
            {
                1000,
                0,
            };
            UInt16[] expectedValues =
            {
                1000,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vint6Ar," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xint6Ar," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
                "System.OverflowException",
            };
            Int64[] errorValues =
            {
                Int64.MaxValue,
                Int64.MinValue,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i]);
                    iCountErrors++;
                    strLoc = "Err_EXint6ArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXint6ArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            Console.WriteLine("Uncaught Exception in UInt16 Convert.ToUInt16( Int64 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Int16");
        }
        try {
            Int16[] testValues =
            {
                1000,
                0,
            };
            UInt16[] expectedValues =
            {
                1000,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vint1Ar," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xint1Ar," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
            };
            Int16[] errorValues =
            {
                Int16.MinValue,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i]);
                    iCountErrors++;
                    strLoc = "Err_EXint1ArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXint1ArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            Console.WriteLine("Uncaught Exception in UInt16 Convert.ToUInt16( Int16 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Decimal");
        }
        try {
            Decimal[] testValues =
            {
                new Decimal(1000),
                new Decimal(0),
            };
            UInt16[] expectedValues =
            {
                1000,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vdeciAr," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xdeciAr," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
                "System.OverflowException",
            };
            Decimal[] errorValues =
            {
                Decimal.MaxValue,
                Decimal.MinValue,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i]);
                    iCountErrors++;
                    strLoc = "Err_EXdeciArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXdeciArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            Console.WriteLine("Uncaught Exception in UInt16 Convert.ToUInt16( Decimal )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: String");
        }
        try {
            String[] testValues =
            {
                "1000",
                "0",
                UInt16.MaxValue.ToString(),
                null,
            };
            UInt16[] expectedValues =
            {
                1000,
                0,
                UInt16.MaxValue,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vstriAr," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xstriAr," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
                "System.OverflowException",
                "System.FormatException",
            };
            String[] errorValues =
            {
                "-1",
                Decimal.MaxValue.ToString(),
                "abba",
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i]);
                    iCountErrors++;
                    strLoc = "Err_EXstriArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXstriArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            Console.WriteLine("Uncaught Exception in UInt16 Convert.ToUInt16( String )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: String");
        }
        try {
            String[] testValues =
            {
                "1000",
                "0",
                UInt16.MaxValue.ToString(),
                null,
            };
            UInt16[] expectedValues =
            {
                1000,
                0,
                UInt16.MaxValue,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i], new NumberFormatInfo());
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vstriAr," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xstriAr," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
                "System.OverflowException",
                "System.FormatException",
            };
            String[] errorValues =
            {
                "-1",
                Decimal.MaxValue.ToString(),
                "abba",
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i], new NumberFormatInfo());
                    iCountErrors++;
                    strLoc = "Err_EXstriArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXstriArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            Console.WriteLine("Uncaught Exception in UInt16 Convert.ToUInt16( String )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Byte");
        }
        try {
            Byte[] testValues =
            {
                Byte.MaxValue,
                Byte.MinValue,
            };
            UInt16[] expectedValues =
            {
                255,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vSByteAr," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xSByteAr," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
        } catch (Exception e) {
            Console.WriteLine("Uncaught Exception in UInt16 Convert.ToUInt16( Byte )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: String, Int32");
        }
        try {
            String [] dummy  = { null, };
            UInt16    result = Convert.ToUInt16(dummy[0], 10);
            if (result != 0)
            {
                iCountErrors++;
                strLoc = "Err_xstri2A1";
                Console.Error.WriteLine(strLoc + " No Exception Thrown.");
            }
            result = Convert.ToUInt16(dummy[0], 2);
            if (result != 0)
            {
                iCountErrors++;
                strLoc = "Err_xstri2A1";
                Console.Error.WriteLine(strLoc + " No Exception Thrown.");
            }
            result = Convert.ToUInt16(dummy[0], 8);
            if (result != 0)
            {
                iCountErrors++;
                strLoc = "Err_xstri2A1";
                Console.Error.WriteLine(strLoc + " No Exception Thrown.");
            }
            result = Convert.ToUInt16(dummy[0], 16);
            if (result != 0)
            {
                iCountErrors++;
                strLoc = "Err_xstri2A1";
                Console.Error.WriteLine(strLoc + " No Exception Thrown.");
            }
        } catch (Exception e) {
            iCountErrors++;
            strLoc = "Err_xstri2C1";
            Console.Error.WriteLine(strLoc + " Wrong Exception Thrown: " + e.GetType().FullName);
        }
        try {
            String[] testValues =
            {
                "ffff",
                "65535",
                "177777",
                "1111111111111111",
                "0",
                "0",
                "0",
                "0",
            };
            Int32[] testBases =
            {
                16,
                10,
                8,
                2,
                16,
                10,
                8,
                2,
            };
            UInt16[] expectedValues =
            {
                UInt16.MaxValue,
                UInt16.MaxValue,
                UInt16.MaxValue,
                UInt16.MaxValue,
                UInt16.MinValue,
                UInt16.MinValue,
                UInt16.MinValue,
                UInt16.MinValue,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i], testBases[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vstr2Ar," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xstr2Ar," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.FormatException",
                "System.ArgumentException",
                "System.ArgumentException",
                "System.FormatException",
            };
            String[] errorValues =
            {
                "12",
                "11",
                "abba",
                "ffffffffffffffffffff"
            };
            Int32[] errorBases =
            {
                2,
                3,
                5,
                8,
                16,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i], errorBases[i]);
                    iCountErrors++;
                    strLoc = "Err_EXstr2ArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXstr2ArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_98934! Uncaught Exception in UInt16 Convert.ToUInt16( str2int )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: SByte");
        }
        try {
            SByte[] testValues =
            {
                100,
                0,
            };
            UInt16[] expectedValues =
            {
                100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vint8Ar," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xint8Ar," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
            };
            SByte[] errorValues =
            {
                SByte.MinValue
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i]);
                    iCountErrors++;
                    strLoc = "Err_EXint3ArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXint3ArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_433jk! Uncaught Exception in UInt16 Convert.ToUInt16( SByte )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: UInt32");
        }
        try {
            UInt32[] testValues =
            {
                100,
                0,
            };
            UInt16[] expectedValues =
            {
                100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vUInt32Ar," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xUInt32Ar," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
            };
            UInt32[] errorValues =
            {
                UInt32.MaxValue,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i]);
                    iCountErrors++;
                    strLoc = "Err_EXUInt32ArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXUInt32ArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_984yy! Uncaught Exception in UInt16 Convert.ToUInt16( UInt32 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: UInt64");
        }
        try {
            UInt64[] testValues =
            {
                100,
                0,
            };
            UInt16[] expectedValues =
            {
                100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vUInt64Ar," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xUInt64Ar," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
            };
            UInt64[] errorValues =
            {
                UInt64.MaxValue,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    UInt16 result = Convert.ToUInt16(errorValues[i]);
                    iCountErrors++;
                    strLoc = "Err_EXUInt64ArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXUInt64ArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_848ey! Uncaught Exception in UInt16 Convert.ToUInt16( UInt64 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: UInt16");
        }
        try {
            UInt16[] testValues =
            {
                UInt16.MaxValue, UInt16.MinValue
            };
            UInt16[] expectedValues =
            {
                UInt16.MaxValue, UInt16.MinValue
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vUInt16Ar," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] + "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xUInt16Ar," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_4789y! Uncaught Exception in Byte Convert.ToUInt16( UInt16 )");
            Console.WriteLine("Exception->" + e.GetType().ToString());
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Char");
        }
        try {
            Char[] testValues =
            {
                Char.MaxValue,
                Char.MinValue,
                'b'
            };
            UInt16[] expectedValues =
            {
                (UInt16)Char.MaxValue,
                (UInt16)Char.MinValue,
                98
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    UInt16 result = Convert.ToUInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vcharAr," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xcharAr," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_4789y! Uncaught Exception in UInt16 Convert.ToUInt16( Char )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        strLoc = "Err_dew452,";
        try
        {
            iCountTestcases++;
            UInt16 bTest = Convert.ToUInt16(new Object());
            Console.Error.WriteLine(strLoc + " No Exception Thrown");
        }
        catch (InvalidCastException)
        {}
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
            Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
        }
        strLoc = "Err_dew452,";
        try
        {
            iCountTestcases++;
            UInt16 bTest = Convert.ToUInt16(new Object(), new NumberFormatInfo());
            Console.Error.WriteLine(strLoc + " No Exception Thrown");
        }
        catch (InvalidCastException)
        {}
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
            Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
        }
        strLoc = "Err_dew452,";
        try
        {
            iCountTestcases++;
            UInt16 bTest = Convert.ToUInt16(DateTime.Now);
            Console.Error.WriteLine(strLoc + " No Exception Thrown");
        }
        catch (InvalidCastException)
        {}
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
            Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
        }
        Console.Error.Write(s_strTFName);
        Console.Error.Write(": ");
        if (iCountErrors == 0)
        {
            Console.Error.WriteLine(" iCountTestcases==" + iCountTestcases + " paSs");
            return(true);
        }
        else
        {
            Console.Error.WriteLine(s_strTFPath + s_strTFName + ".cs");
            Console.Error.WriteLine(" iCountTestcases==" + iCountTestcases);
            Console.Error.WriteLine("FAiL");
            Console.Error.WriteLine(" iCountErrors==" + iCountErrors);
            return(false);
        }
    }
Example #28
0
 public override bool Equals(object obj)
 {
     return(val.Equals(obj));
 }