コード例 #1
0
ファイル: Int16Test.cs プロジェクト: yonder/mono
 public void TestEquals()
 {
     Assert.IsTrue(MyInt16_1.Equals(MyInt16_1));
     Assert.IsTrue(MyInt16_1.Equals((object)(Int16)(-42)));
     Assert.IsTrue(MyInt16_1.Equals((object)(SByte)(-42)) == false);
     Assert.IsTrue(MyInt16_1.Equals(MyInt16_2) == false);
 }
コード例 #2
0
ファイル: Int16.cs プロジェクト: wuyou201400/corefx
    public static void TestEquals()
    {
        Int16 i = -911;

        Assert.True(i.Equals((Int16)(-911)));

        Assert.True(!i.Equals((Int16)911));
        Assert.True(!i.Equals((Int16)0));
    }
コード例 #3
0
ファイル: cast_to.cs プロジェクト: wuyou201400/corefx
        private static bool VerifyInt16ImplicitCastToBigInteger(Int16 value)
        {
            bool       ret = true;
            BigInteger bigInteger;

            bigInteger = value;

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

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

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

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

            return(ret);
        }
コード例 #4
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Test two different int16");

        try
        {
            Int16 i       = TestLibrary.Generator.GetInt16(-55);
            Int16 number1 = this.GetInt16(Int16.MinValue, (Int16)(i - 1));
            Int16 number2 = this.GetInt16(i, Int16.MaxValue);
            if (number1.Equals(number2))
            {
                TestLibrary.TestFramework.LogError("003", String.Format("equal two unqual number did not return false,the two number is {0}and{1}", number1, number2));
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e);
            retVal = false;
        }

        return(retVal);
    }
コード例 #5
0
ファイル: Int16.cs プロジェクト: wuyou201400/corefx
    public static void TestEqualsObject()
    {
        Int16 i = 789;

        object obj1 = (Int16)789;

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

        object obj2 = (Int16)(-789);

        Assert.True(!i.Equals(obj2));

        object obj3 = (Int16)0;

        Assert.True(!i.Equals(obj3));
    }
コード例 #6
0
ファイル: int16_equals.cs プロジェクト: wei772/docs-1
    public static void Main()
    {
        try
        {
// <Snippet1>
            Int16 myVariable1 = 20;
            Int16 myVariable2 = 20;

            // Get and 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);
        }
    }
コード例 #7
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLMessageRecipient)obj;

            //reference types
            if (!Object.Equals(Error, other.Error))
            {
                return(false);
            }
            //value types
            if (!m_message.Equals(other.m_message))
            {
                return(false);
            }
            if (!m_recipient.Equals(other.m_recipient))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }
            if (!m_errorCount.Equals(other.m_errorCount))
            {
                return(false);
            }
            if (!m_sendDT.Equals(other.m_sendDT))
            {
                return(false);
            }
            if (!m_status.Equals(other.m_status))
            {
                return(false);
            }
            if (!m_collectorPayment.Equals(other.m_collectorPayment))
            {
                return(false);
            }
            if (!m_isCharged.Equals(other.m_isCharged))
            {
                return(false);
            }

            return(true);
        }
コード例 #8
0
        //  解析协议
        private void DecodeProtocol(byte[] buffer)
        {
            Int16 messageLen = BitConverter.ToInt16(buffer, 0);
            Int16 protocol   = BitConverter.ToInt16(buffer, 2);

            if (protocol.Equals(Protocol.ProtocolNum.Exception) || protocol.Equals(Protocol.ProtocolNum.Disconnect))
            {
                isConnected = false;
                return;
            }

            Int16  strLen = BitConverter.ToInt16(buffer, 4);
            string str    = System.Text.Encoding.UTF8.GetString(buffer, 6, strLen);

            Console.WriteLine("Length: " + messageLen);
            Console.WriteLine("Protocol:" + protocol);
            Console.WriteLine("Content:" + str);
        }
コード例 #9
0
        private IEnumerable <Sequence> findInLine(Pointer head, Func <Pointer, Pointer> move, char direction)
        {
            Int16 counter  = 0;
            var   position = head;
            var   result   = new List <Sequence>();

            while (true)
            {
                var next = move(position);
                if (next.Equals(stopPointer))
                {
                    break;
                }
                var value     = getValue(position);
                var nextValue = getValue(next);
                var isEquals  = nextValue.Equals(value);
                if (!isEquals && !counter.Equals(0))
                {
                    result.Add(new Sequence(direction, value,
                                            (Int16)(counter + 1),
                                            head));
                    counter = 0;
                }
                if (isEquals && counter.Equals(0))
                {
                    head = position;
                }
                if (isEquals)
                {
                    ++counter;
                }
                position = next;
            }
            if (!counter.Equals(0))
            {
                result.Add(new Sequence(direction,
                                        getValue(position),
                                        (Int16)(counter + 1),
                                        head));
            }
            return(result);
        }
コード例 #10
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object" /> is equal to this <see cref="SecsInt16"/> instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this <see cref="SecsInt16"/> instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this <see cref="SecsInt16"/> instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (obj == null || !(obj is SecsInt16))
            {
                return(false);
            }

            SecsInt16 sobj = obj as SecsInt16;

            return(_value.Equals(sobj._value));
        }
コード例 #11
0
ファイル: Int16Test.cs プロジェクト: lambertlb/CppTranslator
        private void MethodTests()
        {
            featureTest.FailureMessage = "\tFailed Int16 Method Test";
            featureTest.Send("Int16 Method Test");
            Int16  value1 = 1;
            Int16  value2 = 2;
            Int16  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(Int16.Parse("33") == 33);
            String str = 35.ToString();

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

            featureTest.AssertTrue(Int16.TryParse(str, out parsed));
            featureTest.AssertTrue(parsed == 35);
        }
コード例 #12
0
        private void readLine(Int16 row)
        {
            Int16 col   = 0;
            var   input = Console.ReadLine();

            input.Split().ToList().ForEach(item =>
            {
                if (!item.Length.Equals(1))
                {
                    throw new InputError("Invalid input format!");
                }
                if (col.Equals(N))
                {
                    throw new InputError("Invalid row too large!");
                }
                values[row, col] = item[0];
                ++col;
            });
            if (!col.Equals(N))
            {
                throw new InputError("Invalid row too short!");
            }
        }
コード例 #13
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLEmailTemplate)obj;

            //reference types
            if (!Object.Equals(m_name, other.m_name))
            {
                return(false);
            }
            if (!Object.Equals(m_sender, other.m_sender))
            {
                return(false);
            }
            if (!Object.Equals(m_subject, other.m_subject))
            {
                return(false);
            }
            if (!Object.Equals(m_body, other.m_body))
            {
                return(false);
            }
            //value types
            if (!m_templateId.Equals(other.m_templateId))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }

            return(true);
        }
コード例 #14
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLLibraryOption)obj;

            //reference types
            //value types
            if (!m_question.Equals(other.m_question))
            {
                return(false);
            }
            if (!m_optionId.Equals(other.m_optionId))
            {
                return(false);
            }
            if (!m_optionType.Equals(other.m_optionType))
            {
                return(false);
            }
            if (!m_displayOrder.Equals(other.m_displayOrder))
            {
                return(false);
            }
            if (!m_optionValue.Equals(other.m_optionValue))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }

            return(true);
        }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLRole)obj;

            //reference types
            if (!Object.Equals(m_name, other.m_name))
            {
                return(false);
            }
            if (!Object.Equals(m_description, other.m_description))
            {
                return(false);
            }
            //value types
            if (!m_roleId.Equals(other.m_roleId))
            {
                return(false);
            }
            if (!m_permissions.Equals(other.m_permissions))
            {
                return(false);
            }
            if (!m_isBuiltIn.Equals(other.m_isBuiltIn))
            {
                return(false);
            }
            if (!m_isClientRole.Equals(other.m_isClientRole))
            {
                return(false);
            }

            return(true);
        }
コード例 #16
0
    void prepare(plus.Security.Principal.Identity user)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder("");
        Int16       ApplicationID    = 0;
        string      category         = "";
        IDictionary _screens         = user.GetScreens();

        foreach (DictionaryEntry screen in _screens)
        {
            IDictionary screenObj = (Dictionary <string, object>)screen.Value;
            if (screenObj["ParentID"] != DBNull.Value)
            {
                continue;
            }


            if (!Int16.Equals(ApplicationID, Convert.ToInt16(screenObj["ApplicationID"])))
            {
                if (ApplicationID != 0)
                {
                    sb.Append("</div>");
                }
                // Applicatio div
                sb.AppendFormat("<h2>{0}</h2><h2 style='font: 0.9em/22px calibri; color:#666;'>{1}</h2><div class='div-application'>", screenObj["Application"], screenObj["APPDescription"]);
            }
            else if (!string.Equals(category, screenObj["Category"]))
            {
                sb.AppendFormat("<div class='div-application' style='border:none; min-height:1px'></div>");
            }

            string icon = screenObj["icon"].ToString();
            if (!icon.Contains("http"))
            {
                icon = "../skin/cpanel/" + icon + ".png";
            }
            sb.AppendFormat("<div class='div-screen'><a href='../page/init#path:=::{0}'><img src='{1}'><label><bdi>{2}</bdi></label><span><bdi>{3}</bdi></span></a></div>",
                            plus.Security.Cryptography.SimpleEncryption.EncryptPath((string)screenObj["FullPath"]), icon, screenObj["Name"], screenObj["Description"]);

            category      = screenObj["Category"] as string;
            ApplicationID = Convert.ToInt16(screenObj["ApplicationID"]);
        }

        cpanel.InnerHtml = sb.ToString();
    }
コード例 #17
0
        public int ConsultarEstoque(string NumeroProduto)
        {
            int estoque = 0;

            try
            {
                using (ProvedorEstoque database = new ProvedorEstoque())
                {
                    ProdutoEstoque matchingProduct = database.ProdutoE.First(
                        p => Int16.Equals(p.NumeroProduto, NumeroProduto));
                    estoque = matchingProduct.EstoqueProduto;
                }
            }
            catch
            {
                // Ignore exceptions in this implementation
            }
            return(estoque);
        }
コード例 #18
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLViewPage)obj;

            //reference types
            //value types
            if (!m_viewId.Equals(other.m_viewId))
            {
                return(false);
            }
            if (!m_survey.Equals(other.m_survey))
            {
                return(false);
            }
            if (!m_page.Equals(other.m_page))
            {
                return(false);
            }
            if (!m_showResponses.Equals(other.m_showResponses))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }

            return(true);
        }
コード例 #19
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLResponseDetail)obj;

            //reference types
            if (!Object.Equals(m_userInput, other.m_userInput))
            {
                return(false);
            }
            //value types
            if (!m_response.Equals(other.m_response))
            {
                return(false);
            }
            if (!m_question.Equals(other.m_question))
            {
                return(false);
            }
            if (!m_selectedOption.Equals(other.m_selectedOption))
            {
                return(false);
            }
            if (!m_selectedColumn.Equals(other.m_selectedColumn))
            {
                return(false);
            }

            return(true);
        }
コード例 #20
0
 protected internal void PropertyChanged(Int16 newValue)
 {
     if (!originalValue.Equals(newValue))
     {
         if (item.State.Equals(ItemState.Unchanged))
         {
             item.State = ItemState.Modified;
         }
         Modified = true;
     }
     else
     {
         if (Modified)
         {
             if (item.Fields.FindAll(column => column.Modified && column.FieldType.Equals(FieldCategory.NormalField)).Count.Equals(1))
             {
                 item.State = ItemState.Unchanged;
             }
             Modified = false;
         }
     }
 }
コード例 #21
0
 private void ValidateInterestRate()
 {
     /* The InterestRate property must have a value only if the Type property is set to 1 */
     if (_type.Equals(1) && !_interestRate.HasValue)
     {
         if (_validationErrors.ContainsKey(dictionaryKey))
         {
             _validationErrors[dictionaryKey].Add(validationMessage);
         }
         else
         {
             _validationErrors[dictionaryKey] = new List <string> {
                 validationMessage
             };
         }
         RaiseErrorsChanged("InterestRate");
     }
     else if (_validationErrors.ContainsKey(dictionaryKey))
     {
         _validationErrors.Remove(dictionaryKey);
         RaiseErrorsChanged("InterestRate");
     }
 }
コード例 #22
0
ファイル: int16equals2.cs プロジェクト: yukitos/coreclr
    public bool PosTest5()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest5: Test int16MaxValue");

        try
        {
            Int16  i1 = Int16.MaxValue;
            object ob = Int16.MaxValue;
            if (!i1.Equals(ob))
            {
                TestLibrary.TestFramework.LogError("009", "equals error int16MinValue");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("010", "Unexpected exception: " + e);
            retVal = false;
        }

        return(retVal);
    }
コード例 #23
0
    public bool PosTest3()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest3: Test zero equals zero");

        try
        {
            Int16 i1 = 0;
            Int16 i2 = 0;
            if (!i1.Equals(i2))
            {
                TestLibrary.TestFramework.LogError("005", "0!=0");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpected exception: " + e);
            retVal = false;
        }

        return(retVal);
    }
コード例 #24
0
ファイル: int16equals2.cs プロジェクト: yukitos/coreclr
    public bool PosTest6()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest6: The argument is not int16 type");

        try
        {
            Int16  i1 = TestLibrary.Generator.GetInt16(-55);
            object ob = Convert.ToInt32(i1);
            if (i1.Equals(ob))
            {
                TestLibrary.TestFramework.LogError("011", "equals error int16MinValue");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("012", "Unexpected exception: " + e);
            retVal = false;
        }

        return(retVal);
    }
コード例 #25
0
ファイル: int16equals2.cs プロジェクト: yukitos/coreclr
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: Test two equal random int16");

        try
        {
            Int16  number1 = TestLibrary.Generator.GetInt16(-55);
            Object ob      = number1;
            if (!number1.Equals(ob))
            {
                TestLibrary.TestFramework.LogError("001", String.Format("equal two equal number {0} did not return true", number1));
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
            retVal = false;
        }

        return(retVal);
    }
コード例 #26
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLView)obj;

            //reference types
            if (!Object.Equals(Name, other.Name))
            {
                return(false);
            }
            if (!Object.Equals(PdfReportName, other.PdfReportName))
            {
                return(false);
            }
            if (!Object.Equals(PdfReportPath, other.PdfReportPath))
            {
                return(false);
            }
            //value types
            if (!m_client.Equals(other.m_client))
            {
                return(false);
            }
            if (!m_userId.Equals(other.m_userId))
            {
                return(false);
            }
            if (!m_survey.Equals(other.m_survey))
            {
                return(false);
            }
            if (!m_viewId.Equals(other.m_viewId))
            {
                return(false);
            }
            if (!m_isDefaultView.Equals(other.m_isDefaultView))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }
            if (!m_timePeriodStart.Equals(other.m_timePeriodStart))
            {
                return(false);
            }
            if (!m_timePeriodEnd.Equals(other.m_timePeriodEnd))
            {
                return(false);
            }
            if (!m_totalResponseTime.Equals(other.m_totalResponseTime))
            {
                return(false);
            }
            if (!m_totalResponseTimeUnit.Equals(other.m_totalResponseTimeUnit))
            {
                return(false);
            }
            if (!m_totalResponseTimeOperator.Equals(other.m_totalResponseTimeOperator))
            {
                return(false);
            }
            if (!m_NumberOfQuestionFilters.Equals(other.m_NumberOfQuestionFilters))
            {
                return(false);
            }
            if (!m_filtersVersion.Equals(other.m_filtersVersion))
            {
                return(false);
            }
            if (!m_summaryDesignVersion.Equals(other.m_summaryDesignVersion))
            {
                return(false);
            }
            if (!m_summaryRecordedResponses.Equals(other.m_summaryRecordedResponses))
            {
                return(false);
            }
            if (!m_summaryFiltersVersion.Equals(other.m_summaryFiltersVersion))
            {
                return(false);
            }
            if (!m_sumaryGenerationDt.Equals(other.m_sumaryGenerationDt))
            {
                return(false);
            }
            if (!m_summaryVisibleResponses.Equals(other.m_summaryVisibleResponses))
            {
                return(false);
            }
            if (!SummaryFilteredResponses.Equals(other.SummaryFilteredResponses))
            {
                return(false);
            }
            if (!PdfReportIsValid.Equals(other.PdfReportIsValid))
            {
                return(false);
            }
            if (!PdfReportSize.Equals(other.PdfReportSize))
            {
                return(false);
            }
            if (!PdfReportCreationDt.Equals(other.PdfReportCreationDt))
            {
                return(false);
            }

            return(true);
        }
コード例 #27
0
 public override bool Equals(object obj)
 {
     return(val.Equals(obj));
 }
コード例 #28
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLClientUser)obj;

            //reference types
            if (!Object.Equals(m_title, other.m_title))
            {
                return(false);
            }
            if (!Object.Equals(m_department, other.m_department))
            {
                return(false);
            }
            if (!Object.Equals(m_firstName, other.m_firstName))
            {
                return(false);
            }
            if (!Object.Equals(m_lastName, other.m_lastName))
            {
                return(false);
            }
            if (!Object.Equals(m_timeZoneId, other.m_timeZoneId))
            {
                return(false);
            }
            if (!Object.Equals(m_prefecture, other.m_prefecture))
            {
                return(false);
            }
            if (!Object.Equals(m_town, other.m_town))
            {
                return(false);
            }
            if (!Object.Equals(m_address, other.m_address))
            {
                return(false);
            }
            if (!Object.Equals(m_zip, other.m_zip))
            {
                return(false);
            }
            if (!Object.Equals(m_telephone1, other.m_telephone1))
            {
                return(false);
            }
            if (!Object.Equals(m_telephone2, other.m_telephone2))
            {
                return(false);
            }
            if (!Object.Equals(m_email, other.m_email))
            {
                return(false);
            }
            if (!Object.Equals(m_comment, other.m_comment))
            {
                return(false);
            }
            //value types
            if (!m_client.Equals(other.m_client))
            {
                return(false);
            }
            if (!m_userId.Equals(other.m_userId))
            {
                return(false);
            }
            if (!m_defaultLanguage.Equals(other.m_defaultLanguage))
            {
                return(false);
            }
            if (!m_country.Equals(other.m_country))
            {
                return(false);
            }
            if (!m_isActive.Equals(other.m_isActive))
            {
                return(false);
            }
            if (!m_isBuiltIn.Equals(other.m_isBuiltIn))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }
            if (!m_role.Equals(other.m_role))
            {
                return(false);
            }
            if (!m_lastActivityDate.Equals(other.m_lastActivityDate))
            {
                return(false);
            }

            return(true);
        }
コード例 #29
0
    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,
            };
            Int16[] expectedValues =
            {
                (Int16)1,
                (Int16)0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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) {
            iCountErrors++;
            Console.WriteLine("Error_498y7! Uncaught Exception in Int16 Convert.ToInt16( Boolean )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Double");
        }
        try {
            Double[] testValues =
            {
                100.0,
                -100.0,
                0,
            };
            Int16[] expectedValues =
            {
                (short)100,
                (short)-100,
                (short)0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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)Int32.MaxValue),
                ((Double)Int32.MinValue),
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    Int16 result = Convert.ToInt16(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) {
            iCountErrors++;
            Console.WriteLine("Error_8298d! Uncaught Exception in Int16 Convert.ToInt16( Double )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Single");
        }
        try {
            Single[] testValues =
            {
                100.0f,
                -100.0f,
                0.0f,
            };
            Int16[] expectedValues =
            {
                (short)100,
                (short)-100,
                (short)0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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,
                Single.MinValue,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    Int16 result = Convert.ToInt16(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) {
            iCountErrors++;
            Console.WriteLine("Error_048hd!Uncaught Exception in Int16 Convert.ToInt16( Single )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Int32");
        }
        try {
            Int32[] testValues =
            {
                100,
                -100,
                0,
            };
            Int16[] expectedValues =
            {
                ((Int16)100),
                -100,
                ((Int16)0),
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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.MaxValue,
                Int32.MinValue,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    Int16 result = Convert.ToInt16(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_099g9! Uncaught Exception in Int16 Convert.ToInt16( Int32 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Int64");
        }
        try {
            Int64[] testValues =
            {
                100,
                -100,
                0,
            };
            Int16[] expectedValues =
            {
                ((Int16)100),
                -100,
                ((Int16)0),
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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]);
                    }
                    Int16 result = Convert.ToInt16(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) {
            iCountErrors++;
            Console.WriteLine("Error_9084u! Uncaught Exception in Int16 Convert.ToInt16( Int64 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Decimal");
        }
        try {
            Decimal[] testValues =
            {
                new Decimal(100),
                new Decimal(-100),
                new Decimal(0.0),
            };
            Int16[] expectedValues =
            {
                ((Int16)100),
                -100,
                ((Int16)0),
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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]);
                    }
                    Int16 result = Convert.ToInt16(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) {
            iCountErrors++;
            Console.WriteLine("Error_6565t Uncaught Exception in Int16 Convert.ToInt16( Decimal )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: String");
        }
        try {
            String[] testValues =
            {
                "100",
                "-100",
                "0",
                null,
            };
            Int16[] expectedValues =
            {
                ((Int16)100),
                -100,
                ((Int16)0),
                ((Int16)0),
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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 =
            {
                Int32.MaxValue.ToString(),
                Int64.MaxValue.ToString(),
                "abba",
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    Int16 result = Convert.ToInt16(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) {
            iCountErrors++;
            Console.WriteLine("Error_89887! Uncaught Exception in Int16 Convert.ToInt16( String )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: String");
        }
        try {
            String[] testValues =
            {
                "100",
                "-100",
                "0",
                null,
            };
            Int16[] expectedValues =
            {
                ((Int16)100),
                -100,
                ((Int16)0),
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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 =
            {
                Int32.MaxValue.ToString(),
                Int64.MaxValue.ToString(),
                "abba",
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    Int16 result = Convert.ToInt16(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) {
            iCountErrors++;
            Console.WriteLine("Error_89887! Uncaught Exception in Int16 Convert.ToInt16( String )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Byte");
        }
        try {
            Byte[] testValues =
            {
                Byte.MaxValue,
                Byte.MinValue,
            };
            Int16[] expectedValues =
            {
                ((Int16)255),
                ((Int16)0),
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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) {
            iCountErrors++;
            Console.WriteLine("Error_24ree! Uncaught Exception in Int16 Convert.ToInt16( Byte )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: String, Int32");
        }
        try {
            String[] testValues =
            {
                "7fff",
                "32767",
                "77777",
                "111111111111111",
                "8000",
                "-32768",
                "100000",
                "1000000000000000",
            };
            Int32[] testBases =
            {
                16,
                10,
                8,
                2,
                16,
                10,
                8,
                2,
            };
            Int16[] expectedValues =
            {
                Int16.MaxValue,
                Int16.MaxValue,
                Int16.MaxValue,
                Int16.MaxValue,
                Int16.MinValue,
                Int16.MinValue,
                Int16.MinValue,
                Int16.MinValue,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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);
                }
            }
            try {
                String [] dummy  = { null, };
                Int16     result = Convert.ToInt16(dummy[0], 10);
                if (result != 0)
                {
                    iCountErrors++;
                    strLoc = "Err_xstri2A1";
                    Console.Error.WriteLine(strLoc + " No Exception Thrown.");
                }
                result = Convert.ToInt16(dummy[0], 2);
                if (result != 0)
                {
                    iCountErrors++;
                    strLoc = "Err_xstri2A1";
                    Console.Error.WriteLine(strLoc + " No Exception Thrown.");
                }
                result = Convert.ToInt16(dummy[0], 8);
                if (result != 0)
                {
                    iCountErrors++;
                    strLoc = "Err_xstri2A1";
                    Console.Error.WriteLine(strLoc + " No Exception Thrown.");
                }
                result = Convert.ToInt16(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);
            }
            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]);
                    }
                    Int16 result = Convert.ToInt16(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 Int16 Convert.ToInt16( str2int )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: SByte");
        }
        try {
            SByte[] testValues =
            {
                100,
                -100,
                0,
            };
            Int16[] expectedValues =
            {
                ((Int16)100),
                -100,
                ((Int16)0),
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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);
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_433jk! Uncaught Exception in Int16 Convert.ToInt16( SByte )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: UInt16");
        }
        try {
            UInt16[] testValues =
            {
                100,
                0,
            };
            Int16[] expectedValues =
            {
                ((Int16)100),
                ((Int16)0),
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vUInt3216Ar," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] +
                                                "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xUInt3216Ar," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
            String[] expectedExceptions =
            {
                "System.OverflowException",
            };
            UInt16[] errorValues =
            {
                UInt16.MaxValue,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    Int16 result = Convert.ToInt16(errorValues[i]);
                    iCountErrors++;
                    strLoc = "Err_EXUInt3216ArNoE," + i;
                    Console.WriteLine(strLoc + " Exception not Thrown!");
                } catch (Exception e) {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_EXUInt3216ArWrE," + i;
                        Console.WriteLine(strLoc + " Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_98987! Uncaught Exception in Int16 Convert.ToInt16( UInt16 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: UInt32");
        }
        try {
            UInt32[] testValues =
            {
                100,
                0,
            };
            Int16[] expectedValues =
            {
                ((Int16)100),
                ((Int16)0),
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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]);
                    }
                    Int16 result = Convert.ToInt16(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 Int16 Convert.ToInt16( UInt32 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: UInt64");
        }
        try {
            UInt64[] testValues =
            {
                100,
                0,
            };
            Int16[] expectedValues =
            {
                ((Int16)100),
                ((Int16)0),
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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]);
                    }
                    Int16 result = Convert.ToInt16(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 Int16 Convert.ToInt16( UInt64 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Char");
        }
        try {
            Char[] testValues =
            {
                'A',
                Char.MinValue,
            };
            Int16[] expectedValues =
            {
                (Int16)'A',
                (Int16)Char.MinValue
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(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 Byte Convert.ToInt16( Char )");
            Console.WriteLine("Exception->" + e.GetType().ToString());
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Int16");
        }
        try {
            Int16[] testValues =
            {
                Int16.MaxValue, Int16.MinValue, 0
            };
            Int16[] expectedValues =
            {
                Int16.MaxValue, Int16.MinValue, 0
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int16 result = Convert.ToInt16(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vInt16Ar," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] + "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xInt16Ar," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_4789y! Uncaught Exception in Byte Convert.ToInt16( Int16 )");
            Console.WriteLine("Exception->" + e.GetType().ToString());
        }
        strLoc = "Err_dew452,";
        try
        {
            iCountTestcases++;
            Int16 bTest = Convert.ToInt16(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++;
            Int16 bTest = Convert.ToInt16(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++;
            Int16 bTest = Convert.ToInt16(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);
        }
    }
コード例 #30
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLViewQuestion)obj;

            //reference types
            //value types
            if (!m_viewId.Equals(other.m_viewId))
            {
                return(false);
            }
            if (!m_survey.Equals(other.m_survey))
            {
                return(false);
            }
            if (!m_question.Equals(other.m_question))
            {
                return(false);
            }
            if (!m_showResponses.Equals(other.m_showResponses))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }
            if (!m_chartType.Equals(other.m_chartType))
            {
                return(false);
            }
            if (!m_labelType.Equals(other.m_labelType))
            {
                return(false);
            }
            if (!m_axisScale.Equals(other.m_axisScale))
            {
                return(false);
            }
            if (!m_scaleMaxPercentage.Equals(other.m_scaleMaxPercentage))
            {
                return(false);
            }
            if (!m_scaleMaxAbsolute.Equals(other.m_scaleMaxAbsolute))
            {
                return(false);
            }
            if (!m_summaryTotalAnswered.Equals(other.m_summaryTotalAnswered))
            {
                return(false);
            }
            if (!m_summaryTotalSkipped.Equals(other.m_summaryTotalSkipped))
            {
                return(false);
            }

            return(true);
        }