Exemple #1
0
        private int SaveAssetMovementDetails()
        {
            objSQLdb = new SQLDB();
            int       iRes       = 0;
            string    strCommand = "";
            DataTable dt         = new DataTable();

            try
            {
                if (txtToEcode.Text.Length == 0)
                {
                    txtToEcode.Text = "0";
                }


                if (TrnNo.Equals(0))
                {
                    strCommand = "SELECT ISNULL(MAX(FAMR_TRN_NO),0)+1 TrnNo FROM FIXED_ASSETS_MOVEMENT_REG " +
                                 " WHERE FAMR_ASSET_SL_NO='" + txtAssetSLNo.Text.ToString() + "' ";
                    dt = objSQLdb.ExecuteDataSet(strCommand).Tables[0];

                    if (dt.Rows.Count > 0)
                    {
                        TrnNo = Convert.ToInt32(dt.Rows[0]["TrnNo"].ToString());
                    }
                }

                objSQLdb   = new SQLDB();
                strCommand = "";

                strCommand = "DELETE FROM FIXED_ASSETS_MOVEMENT_REG WHERE FAMR_ID='" + AssetMovementId + "' ";
                iRes       = objSQLdb.ExecuteSaveData(strCommand);


                strCommand = "";

                objSQLdb = new SQLDB();

                strCommand = "INSERT INTO FIXED_ASSETS_MOVEMENT_REG(FAMR_ASSET_SL_NO " +
                             ", FAMR_TRN_NO " +
                             ", FAMR_TRN_TYPE " +
                             ", FAMR_FROM_BRANCH_CODE " +
                             ", FAMR_FROM_ECODE " +
                             ", FAMR_TO_BRANCH_CODE " +
                             ", FAMR_TO_ECODE " +
                             ", FAMR_GIVEN_DATE " +
                             ", FAMR_STATUS " +
                             ", FAH_CONT_NO " +
                             ", FAMR_ASSET_TAG_NO " +
                             ", FAMR_CREATED_BY " +
                             ", FAMR_CREATED_DATE " +
                             ")VALUES " +
                             "('" + txtAssetSLNo.Text.ToString() +
                             "'," + TrnNo +
                             ",'" + cbTrnType.Tag.ToString() +
                             "','SSBAPCHYD',0,'" + cbToBranch.SelectedValue.ToString() +
                             "'," + Convert.ToInt32(txtToEcode.Text) +
                             ",'" + Convert.ToDateTime(dtpGivenDate.Value).ToString("dd/MMM/yyyy") +
                             "', '" + cbStatus.SelectedItem.ToString() +
                             "', '" + txtContactNo.Text.ToString().Replace(" ", "") +
                             "', '" + txtAssetTagNo.Text.ToString() + "', '" + CommonData.LogUserId +
                             "',getdate())";


                if (strCommand.Length > 10)
                {
                    iRes = objSQLdb.ExecuteSaveData(strCommand);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            return(iRes);
        }
Exemple #2
0
        /// <summary>
        /// Get any differences between the old and new property values.
        /// </summary>
        /// <param name="prevValue">Prevous property value.</param>
        /// <param name="newValue">New property value.</param>
        /// <param name="ObjectState">The state of the object.</param>
        /// <param name="ObjectType">The type of the object.</param>
        /// <param name="propertyInfo">The property being evaluated.</param>
        /// <returns></returns>
        private ChangeLogItem GetChangeLogItem(Object prevValue, Object newValue, ObjectState ObjectState, Type ObjectType, PropertyInfo propertyInfo)
        {
            ChangeLogItem lItem = new ChangeLogItem();

            lItem.OwnerID      = this.OwnerID;
            lItem.OwnerName    = ObjectType.Name;
            lItem.PropertyName = propertyInfo.Name;
            lItem.Type         = ObjectState.ToString().Replace("ToBe", String.Empty); // Get rid of future tense from state name.

            if (Object.ReferenceEquals(propertyInfo.PropertyType, typeof(String)))
            {
                // COMPARE STRINGS

                String logPrevious = HString.SafeTrim(prevValue);
                String logNew      = HString.SafeTrim(newValue);

                if (!logNew.Equals(logPrevious))
                {
                    lItem.PreviousValue = logPrevious;
                    lItem.NewValue      = logNew;
                    return(lItem);
                }
            }
            else if (Object.ReferenceEquals(propertyInfo.PropertyType, typeof(Int32)))
            {
                // COMPARE INTEGERS

                Int32 logPrevious = HNumeric.GetSafeInteger(prevValue);
                Int32 logNew      = HNumeric.GetSafeInteger(newValue);

                if (!logNew.Equals(logPrevious))
                {
                    lItem.PreviousValue = logPrevious.ToString();
                    lItem.NewValue      = logNew.ToString();
                    return(lItem);
                }
            }
            else if (Object.ReferenceEquals(propertyInfo.PropertyType, typeof(Decimal)))
            {
                // COMPARE DECIMALS

                Decimal logPrevious = HNumeric.GetSafeDecimal(prevValue);
                Decimal logNew      = HNumeric.GetSafeDecimal(newValue);

                if (!logNew.Equals(logPrevious))
                {
                    lItem.PreviousValue = logPrevious.ToString();
                    lItem.NewValue      = logNew.ToString();
                    return(lItem);
                }
            }
            else if (Object.ReferenceEquals(propertyInfo.PropertyType, typeof(DateTime)))
            {
                // COMPARE DATETIMES

                DateTime logPrevious = HDateTime.GetDateTime(prevValue);
                DateTime logNew      = HDateTime.GetDateTime(newValue);

                if (!logNew.Equals(logPrevious))
                {
                    lItem.PreviousValue = logPrevious.ToString();
                    lItem.NewValue      = logNew.ToString();
                    return(lItem);
                }
            }
            else if (propertyInfo.PropertyType.IsEnum)
            {
                // COMPARE ENUMS

                Int32 logPrevious = Convert.ToInt32(prevValue);
                Int32 logNew      = Convert.ToInt32(newValue);

                if (!logNew.Equals(logPrevious))
                {
                    lItem.PreviousValue = logPrevious.ToString();
                    lItem.NewValue      = logNew.ToString();
                    return(lItem);
                }
            }

            return(null);
        }
        private static MagneticModelSet DATreader(string modelFile)
        {
            var outModels = new MagneticModelSet();

            outModels.FileNames.Add(Path.GetFileName(modelFile));

            double tempDbl = 0;

            double earthRadius = 6371.001;                 /* old (default) reference radius */

            using (var stream = new StreamReader(modelFile))
            {
                string inbuff;

                Int32 modelI = -1;                             /* First model will be 0 */

                Int32 lineNumber = 0;

                while ((inbuff = stream.ReadLine()) != null)
                {
                    lineNumber++;

                    inbuff = inbuff.Trim();

                    if (!string.IsNullOrEmpty(inbuff))
                    {
                        var lineParase = inbuff.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);

                        if (lineNumber.Equals(1))
                        {
                            //Min Year
                            double.TryParse(inbuff, NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);

                            outModels.MinDate = tempDbl;
                        }
                        else if (lineNumber.Equals(2))
                        {
                            //Max Year
                            double.TryParse(inbuff, NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);

                            outModels.MaxDate = tempDbl;
                        }
                        else if (inbuff.IndexOf("N", StringComparison.OrdinalIgnoreCase).Equals(0))
                        {
                            /* ignore the rest of the line */
                            earthRadius = Constants.EarthsRadiusInKm;   /* new reference radius */
                        }
                        else if (inbuff.IndexOf("M", StringComparison.OrdinalIgnoreCase).Equals(0) ||
                                 inbuff.IndexOf("S", StringComparison.OrdinalIgnoreCase).Equals(0) ||
                                 inbuff.IndexOf("E", StringComparison.OrdinalIgnoreCase).Equals(0)) /* If 1st 3 chars are spaces */
                        {
                            modelI++;                                                               /* New model */

                            double.TryParse(lineParase.Last(), NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);

                            outModels.AddModel(new MagneticModel
                            {
                                Type = lineParase.First(),
                                Year = tempDbl
                            });
                        }
                        else if (modelI > -1)
                        {
                            /* read in more values for this era */

                            foreach (var ptr in lineParase)
                            {
                                double.TryParse(ptr, NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);

                                outModels.AddCoefficients(modelI, tempDbl);
                            }
                        }
                    }
                }
            }

            if (outModels.NumberOfModels.Equals(0))
            {
                throw new GeoMagExceptionModelNotLoaded(string.Format("Error: No models were detected in the specified file{0}File Name: {1}",
                                                                      Environment.NewLine, Path.GetFileName(modelFile)));
            }

            outModels.EarthRadius = earthRadius;

            return(outModels);
        }
        private static MagneticModelSet COFreader(string modelFile)
        {
            var outModels = new MagneticModelSet();

            outModels.FileNames.Add(Path.GetFileName(modelFile));

            double tempDbl = 0;

            using (var stream = new StreamReader(modelFile))
            {
                string inbuff;

                Int32 mModelIdx = -1;                             /* First model will be 0 */

                Int32 eModelIdx = -1;                             /* First model will be 0 */

                Int32 lineNumber = 0;

                while ((inbuff = stream.ReadLine()) != null)
                {
                    lineNumber++;

                    inbuff = inbuff.Trim();

                    if (!string.IsNullOrEmpty(inbuff))
                    {
                        var lineParase = inbuff.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);

                        if (lineNumber.Equals(1))
                        {
                            outModels.Type = inbuff.CheckStringForModel();
                        }

                        if (!inbuff.CheckStringForModel().Equals(knownModels.NONE))
                        {
                            /* New model */
                            if (outModels.Type.Equals(knownModels.EMM))
                            {
                                double.TryParse(lineParase[0], NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);
                            }
                            else
                            {
                                double.TryParse(lineParase[1], NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);
                            }

                            outModels.AddModel(new MagneticModel
                            {
                                Type = @"M",
                                Year = tempDbl
                            });

                            mModelIdx = outModels.GetModels.Count() - 1;

                            outModels.AddModel(new MagneticModel
                            {
                                Type = @"S",
                                Year = tempDbl
                            });

                            eModelIdx = outModels.GetModels.Count() - 1;
                        }
                        else if (mModelIdx > -1)
                        {
                            if (outModels.Type.Equals(knownModels.EMM))
                            {
                                #region Split File Line Reader
                                Int32 lineDegree = -1;

                                Int32 lineOrder = -1;

                                for (Int32 itemIdx = 0; itemIdx < lineParase.Count(); itemIdx++)
                                {
                                    switch (itemIdx)
                                    {
                                    //Degree(n) (int)
                                    case 0:
                                        Int32.TryParse(lineParase[itemIdx], NumberStyles.Integer, CultureInfo.InvariantCulture, out lineDegree);
                                        break;

                                    //Order(m) (int)
                                    case 1:
                                        Int32.TryParse(lineParase[itemIdx], NumberStyles.Integer, CultureInfo.InvariantCulture, out lineOrder);
                                        break;

                                    //g1 (double)
                                    case 2:
                                        double.TryParse(lineParase[itemIdx], NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);
                                        outModels.AddCoefficients(mModelIdx, tempDbl);
                                        break;

                                    //h1 (double)
                                    case 3:
                                        double.TryParse(lineParase[itemIdx], NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);
                                        if (lineOrder > 0)
                                        {
                                            outModels.AddCoefficients(mModelIdx, tempDbl);
                                        }
                                        break;

                                    //g2 (double)
                                    case 4:
                                        double.TryParse(lineParase[itemIdx], NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);
                                        outModels.AddCoefficients(eModelIdx, tempDbl);
                                        break;

                                    //h2 (double)
                                    case 5:
                                        double.TryParse(lineParase[itemIdx], NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);
                                        if (lineOrder > 0)
                                        {
                                            outModels.AddCoefficients(eModelIdx, tempDbl);
                                        }
                                        break;

                                    //irat (string)
                                    case 6:
                                        //coeffLine.Model = lineParase[itemIdx];
                                        break;

                                    //LineNum (int)
                                    case 7:
                                        //Int32.TryParse(lineParase[itemIdx], NumberStyles.Integer, CultureInfo.InvariantCulture, out tempInt);
                                        //coeffLine.LineNum = tempInt;
                                        break;
                                    }
                                }
                                #endregion
                            }
                            else
                            {
                                #region Single File Line Reader
                                Int32 lineDegree = -1;

                                Int32 lineOrder = -1;

                                for (Int32 itemIdx = 0; itemIdx < lineParase.Count(); itemIdx++)
                                {
                                    switch (itemIdx)
                                    {
                                    //Degree(n) (int)
                                    case 0:
                                        Int32.TryParse(lineParase[itemIdx], NumberStyles.Integer, CultureInfo.InvariantCulture, out lineDegree);
                                        break;

                                    //Order(m) (int)
                                    case 1:
                                        Int32.TryParse(lineParase[itemIdx], NumberStyles.Integer, CultureInfo.InvariantCulture, out lineOrder);
                                        break;

                                    //g1 (double)
                                    case 2:
                                        double.TryParse(lineParase[itemIdx], NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);
                                        outModels.AddCoefficients(mModelIdx, tempDbl);
                                        break;

                                    //h1 (double)
                                    case 3:
                                        double.TryParse(lineParase[itemIdx], NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);
                                        if (lineOrder > 0)
                                        {
                                            outModels.AddCoefficients(mModelIdx, tempDbl);
                                        }
                                        break;

                                    //g2 (double)
                                    case 4:
                                        double.TryParse(lineParase[itemIdx], NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);
                                        outModels.AddCoefficients(eModelIdx, tempDbl);
                                        break;

                                    //h2 (double)
                                    case 5:
                                        double.TryParse(lineParase[itemIdx], NumberStyles.Float, CultureInfo.InvariantCulture, out tempDbl);
                                        if (lineOrder > 0)
                                        {
                                            outModels.AddCoefficients(eModelIdx, tempDbl);
                                        }
                                        break;

                                    //irat (string)
                                    case 6:
                                        //coeffLine.Model = lineParase[itemIdx];
                                        break;

                                    //LineNum (int)
                                    case 7:
                                        //Int32.TryParse(lineParase[itemIdx], NumberStyles.Integer, CultureInfo.InvariantCulture, out tempInt);
                                        //coeffLine.LineNum = tempInt;
                                        break;
                                    }
                                }
                                #endregion
                            }
                        }
                    }
                }
            }

            //Add 5 years to the start date of the final model
            outModels.MaxDate += 5;

            if (outModels.NumberOfModels.Equals(0))
            {
                throw new GeoMagExceptionModelNotLoaded(string.Format("Error: No models were detected in the specified file{0}File Name: {1}",
                                                                      Environment.NewLine, Path.GetFileName(modelFile)));
            }

            return(outModels);
        }
        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 = (VLSystemEmail)obj;

            //reference types
            if (!Object.Equals(m_moduleName, other.m_moduleName))
            {
                return(false);
            }
            if (!Object.Equals(m_fromAddress, other.m_fromAddress))
            {
                return(false);
            }
            if (!Object.Equals(m_fromDisplayName, other.m_fromDisplayName))
            {
                return(false);
            }
            if (!Object.Equals(m_toAddress, other.m_toAddress))
            {
                return(false);
            }
            if (!Object.Equals(m_subject, other.m_subject))
            {
                return(false);
            }
            if (!Object.Equals(m_body, other.m_body))
            {
                return(false);
            }
            if (!Object.Equals(m_error, other.m_error))
            {
                return(false);
            }
            //value types
            if (!m_emailId.Equals(other.m_emailId))
            {
                return(false);
            }
            if (!m_accessToken.Equals(other.m_accessToken))
            {
                return(false);
            }
            if (!m_enterDt.Equals(other.m_enterDt))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }
            if (!m_status.Equals(other.m_status))
            {
                return(false);
            }
            if (!m_sendDT.Equals(other.m_sendDT))
            {
                return(false);
            }

            return(true);
        }
Exemple #6
0
        public MangaObject ParseMangaObject(string Content)
        {
            HtmlDocument MangaObjectDocument = new HtmlDocument();

            MangaObjectDocument.LoadHtml(Content);

            HtmlNode MangaNode = MangaObjectDocument.DocumentNode.SelectSingleNode(".//section[contains(@class, 'manga')]");
            String   Name      = HtmlEntity.DeEntitize(MangaNode.SelectSingleNode(".//div/div[1]/h1/a").InnerText);

            Name = Name.Substring(0, Name.LastIndexOf(' '));
            HtmlNode      AlternateNamesNode = MangaNode.SelectSingleNode(".//div/table/tr/td[2]/table/tr[4]/td");
            List <String> AlternateNames     = (from AltName in HtmlEntity.DeEntitize(AlternateNamesNode.InnerText).Split(';')
                                                select AltName.Trim()).ToList();
            List <String> Authors = (from Node in MangaNode.SelectNodes(".//div/table/tr/td[2]/table/tr[5]/td/a")
                                     select HtmlEntity.DeEntitize(Node.InnerText)).ToList();
            List <String> Artists = (from Node in MangaNode.SelectNodes(".//div/table/tr/td[2]/table/tr[6]/td/a")
                                     select HtmlEntity.DeEntitize(Node.InnerText)).ToList();
            List <String> Genres = (from Node in MangaNode.SelectNodes(".//div/table/tr/td[2]/table/tr[7]/td/a")
                                    select HtmlEntity.DeEntitize(Node.InnerText)).ToList();

            // Detect type
            MangaObjectType MangaType = MangaObjectType.Unknown;
            String          mType     = MangaNode.SelectSingleNode(".//div/table/tr/td[2]/table/tr[8]/td").InnerText.ToLower();

            if (mType.Contains("japanese manga"))
            {
                MangaType = MangaObjectType.Manga;
            }
            else if (mType.Contains("korean manhwa"))
            {
                MangaType = MangaObjectType.Manhwa;
            }

            // Get description
            String Description = HtmlEntity.DeEntitize(MangaNode.SelectSingleNode(".//div/p").InnerText);

            // Chapters
            List <ChapterObject> Chapters = new List <ChapterObject>();

            foreach (HtmlNode ChapterVersionNode in MangaNode.SelectNodes(".//*[@id='list']/div[starts-with(@id, 'stream_')]"))
            {
                foreach (HtmlNode VolumeNode in ChapterVersionNode.SelectNodes(".//div[contains(@class, 'volume')]"))
                {
                    UInt32   Volume         = 0;
                    HtmlNode VolumeNameNode = VolumeNode.SelectSingleNode(".//h4");
                    if (!Equals(VolumeNameNode, null))
                    {
                        String[] idParts = VolumeNameNode.GetAttributeValue("id", "v-1-").Split('-');
                        UInt32.TryParse(idParts[2], out Volume);
                    }

                    foreach (HtmlNode ChapterNode in ChapterVersionNode.SelectNodes(".//div/ul/li"))
                    {
                        HtmlNode InfoNode = ChapterNode.SelectSingleNode(".//a");
                        String   ChapterName = HtmlEntity.DeEntitize(InfoNode.InnerText),
                                 Url = InfoNode.GetAttributeValue("href", null);
                        UInt32 Chapter = 0, SubChapter = 0;

                        Match match = Regex.Match(ChapterName, @"(vol\.(?<Volume>\d+)\s)?ch\.(?<Chapter>\d+)(\.(?<SubChapter>\d+))?");
                        if (match.Success)
                        {
                            if (match.Groups["Volume"].Success)
                            {
                                UInt32.TryParse(match.Groups["Volume"].Value, out Volume);
                            }
                            if (match.Groups["Chapter"].Success)
                            {
                                UInt32.TryParse(match.Groups["Chapter"].Value, out Chapter);
                            }
                            if (match.Groups["SubChapter"].Success)
                            {
                                UInt32.TryParse(match.Groups["SubChapter"].Value, out SubChapter);
                            }
                        }

                        if (Equals(Url, null))
                        {
                            continue;
                        }
                        Url = String.Format("{0}{1}", ExtensionDescriptionAttribute.RootUrl, Url);

                        ChapterObject NewChapterObject = new ChapterObject()
                        {
                            Name       = ChapterName,
                            Volume     = Volume,
                            Chapter    = Chapter,
                            SubChapter = SubChapter,
                            Locations  =
                            {
                                new LocationObject()
                                {
                                    Enabled           = true,
                                    ExtensionName     = ExtensionDescriptionAttribute.Name,
                                    ExtensionLanguage = ExtensionDescriptionAttribute.Language,
                                    Url = Url
                                }
                            }
                        };
                        ChapterObject ExistingChapterObject = Chapters.FirstOrDefault(o =>
                        {
                            if (!Int32.Equals(o.Chapter, NewChapterObject.Chapter))
                            {
                                return(false);
                            }
                            if (!Int32.Equals(o.SubChapter, NewChapterObject.SubChapter))
                            {
                                return(false);
                            }
                            return(true);
                        });
                        if (Equals(ExistingChapterObject, null))
                        {
                            Chapters.Add(NewChapterObject);
                        }
                        else
                        {
                            ExistingChapterObject.Merge(NewChapterObject);
                        }
                    }
                }
            }
            Chapters = Chapters.OrderBy(c => c.Chapter).ThenBy(c => c.SubChapter).ThenBy(c => c.Volume).ToList();

            return(new MangaObject()
            {
                Name = Name,
                AlternateNames = AlternateNames,
                Description = Description,
                Authors = Authors,
                Artists = Artists,
                Genres = Genres,
                MangaType = MangaType,
                Chapters = Chapters
            });
        }
Exemple #7
0
    public Boolean runTest()
    {
        Queue   q1;
        Queue   q2;
        Queue   q3;
        Boolean fPass;

        String[]    strArr;
        Object[]    oArr;
        IEnumerator ienm1;
        Object      oValue;
        Int32       iCount;

        /////////////////////////////////////////////////////////////////////
        // Begin Testing run
        /////////////////////////////////////////////////////////////////////

        // Setup Queue Test
        //[]Testing Method: Queue.Synchronized( Queue )
        try
        {
            // Exception Test Cases
            String[] expectedExceptions =
            {
                "System.ArgumentNullException",
            };
            Queue[] errorValues =
            {
                null,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try
                {
                    Queue result = Queue.Synchronized(errorValues[i]);
                    iCountErrors++;
                }
                catch (Exception e)
                {
                    if (!e.GetType().FullName.Equals(expectedExceptions[i]))
                    {
                        iCountErrors++;
                        Console.WriteLine(" Wrong Exception Thrown " + e.GetType().FullName);
                    }
                }
            }
        }
        catch (Exception e)
        {
            Console.WriteLine("Uncaught Exception in Queue Queue.Synchronized( Queue )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        ////////////////////////////////////////////////////////////////////////////////////////
        // Thread testing...
        // Enqueue
        m_Queue = new Queue();
        m_Queue = Queue.Synchronized(m_Queue);

        Task[] ths = new Task[m_ThreadsToUse];

        try
        {
            for (int i = 0; i < m_ThreadsToUse; i++)
            {
                ths[i] = Task.Factory.StartNew(new Action(this.StartEnThread), CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default);
            }
            m_ThreadCount = m_ThreadsToUse;
            Task.WaitAll(ths);

            Int32 expected = m_ThreadsToUse * m_ThreadAge;
            Int32 result   = m_Queue.Count;

            if (!expected.Equals(result))
            {
                iCountErrors++;
                Console.WriteLine("Err_ENQUEUE Race.  Expected = " + expected + " Result = " + result);
            }
        }
        catch (Exception e)
        {
            iCountErrors++;
            Console.WriteLine("Err_THREAD threw " + e.GetType().FullName);
        }
        /////////////////// DeQueue
        // Less Threads.
        m_ThreadsToUse = (m_ThreadsToUse - 2);     // now we can see differences better (2000 entry overhead)

        try
        {
            m_ThreadCount = m_ThreadsToUse;
            for (int i = 0; i < m_ThreadsToUse; i++)
            {
                ths[i] = Task.Factory.StartNew(new Action(this.StartDeThread), CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default);
            }
            Task.WaitAll(ths);

            Int32 expected = 2 * m_ThreadAge;
            Int32 result   = m_Queue.Count;

            if (!expected.Equals(result))
            {
                iCountErrors++;
                Console.WriteLine("Err_DEQUEUE Race.  Expected = " + expected + " Result = " + result);
            }
        }
        catch (Exception e)
        {
            iCountErrors++;
            Console.WriteLine("Err_THREAD threw " + e.GetType().FullName);
        }

        /////////////////// Dequeue + Enqueue
        // Less Threads.
        m_ThreadsToUse = (m_ThreadsToUse + 2);     // now we can see differences better (2000 entry overhead)

        try
        {
            m_ThreadCount = m_ThreadsToUse;
            for (int i = 0; i < m_ThreadsToUse; i++)
            {
                ths[i] = Task.Factory.StartNew(new Action(this.StartDeEnThread), CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default);
            }
            Task.WaitAll(ths);

            Int32 expected = 2 * m_ThreadAge;
            Int32 result   = m_Queue.Count;

            if (!expected.Equals(result))
            {
                iCountErrors++;
                Console.WriteLine("Err_DEQUEUE Race.  Expected = " + expected + " Result = " + result);
            }
        }
        catch (Exception e)
        {
            iCountErrors++;
            Console.WriteLine("Err_THREAD threw " + e.GetType().FullName);
        }

        /////////////////// Enqueue + Dequeue
        // Less Threads.

        try
        {
            m_ThreadCount = m_ThreadsToUse;
            for (int i = 0; i < m_ThreadsToUse; i++)
            {
                ths[i] = Task.Factory.StartNew(new Action(this.StartEnDeThread), CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default);
            }
            Task.WaitAll(ths);

            Int32 expected = 2 * m_ThreadAge;
            Int32 result   = m_Queue.Count;

            if (!expected.Equals(result))
            {
                iCountErrors++;
                Console.WriteLine("Err_DEQUEUE Race.  Expected = " + expected + " Result = " + result);
            }
        }
        catch (Exception e)
        {
            iCountErrors++;
            Console.WriteLine("Err_THREAD threw " + e.GetType().FullName);
        }


        //[] Synchronized returns a wrapper. We will test all the methods here!!!

        iCountTestcases++;

        fPass = true;
        q1    = new Queue();
        for (int i = 0; i < 10; i++)
        {
            q1.Enqueue("String_" + i);
        }
        q2 = Queue.Synchronized(q1);
        if (q2.Count != q1.Count)
        {
            fPass = false;
        }
        q2.Clear();
        if (q2.Count != 0)
        {
            fPass = false;
        }
        for (int i = 0; i < 10; i++)
        {
            q2.Enqueue("String_" + i);
        }

        for (int i = 0; i < 10; i++)
        {
            if (!((String)q2.Peek()).Equals("String_" + i))
            {
                Console.WriteLine(q2.Peek());
                fPass = false;
            }
            q2.Dequeue();
        }

        if (q2.Count != 0)
        {
            fPass = false;
        }

        if (!q2.IsSynchronized)
        {
            fPass = false;
        }

        for (int i = 0; i < 10; i++)
        {
            q2.Enqueue("String_" + i);
        }
        q3 = Queue.Synchronized(q2);

        if (!q3.IsSynchronized || (q2.Count != q3.Count))
        {
            fPass = false;
        }

        strArr = new String[10];
        q2.CopyTo(strArr, 0);
        for (int i = 0; i < 10; i++)
        {
            if (!strArr[i].Equals("String_" + i))
            {
                fPass = false;
            }
        }

        strArr = new String[10 + 10];
        q2.CopyTo(strArr, 10);
        for (int i = 0; i < 10; i++)
        {
            if (!strArr[i + 10].Equals("String_" + i))
            {
                fPass = false;
            }
        }

        try
        {
            q2.CopyTo(null, 0);
            fPass = false;
        }
        catch (ArgumentNullException)
        {
        }
        catch (Exception)
        {
            fPass = false;
        }

        oArr = q2.ToArray();
        for (int i = 0; i < 10; i++)
        {
            if (!((String)oArr[i]).Equals("String_" + i))
            {
                fPass = false;
            }
        }

        ienm1 = q2.GetEnumerator();
        try
        {
            oValue = ienm1.Current;
            fPass  = false;
        }
        catch (InvalidOperationException)
        {
        }
        catch (Exception)
        {
            fPass = false;
        }

        iCount = 0;
        while (ienm1.MoveNext())
        {
            if (!((String)ienm1.Current).Equals("String_" + iCount))
            {
                fPass = false;
            }
            iCount++;
        }

        ienm1.Reset();
        iCount = 0;
        while (ienm1.MoveNext())
        {
            if (!((String)ienm1.Current).Equals("String_" + iCount))
            {
                fPass = false;
            }
            iCount++;
        }


        ienm1.Reset();
        q2.Dequeue();

        try
        {
            oValue = ienm1.Current;
            fPass  = false;
        }
        catch (InvalidOperationException)
        {
        }
        catch (Exception)
        {
            fPass = false;
        }

        try
        {
            ienm1.MoveNext();
            fPass = false;
        }
        catch (InvalidOperationException)
        {
        }
        catch (Exception)
        {
            fPass = false;
        }

        try
        {
            ienm1.Reset();
            fPass = false;
        }
        catch (InvalidOperationException)
        {
        }
        catch (Exception)
        {
            fPass = false;
        }

        if (!fPass)
        {
            iCountErrors++;
            Console.WriteLine("Unexpect result returned!");
        }

        /////////////////////////////////////////////////////////////////////
        // Diagnostics and reporting of results
        /////////////////////////////////////////////////////////////////////
        return(iCountErrors == 0);
    }
Exemple #8
0
 /// <summary>
 /// Determines whether this instance and a specified object have the same value.
 /// </summary>
 /// <param name="other">The <see cref="Concatenator"/> to compare with the current <see cref="Node"/>.</param>
 /// <returns><c>true</c> if the specified <see cref="Node"/> is equal to the current <see cref="Node"/>; otherwise, <c>false</c>.</returns
 public Boolean Equals(Repeater other) => Node.Equals(other.Node) && Count.Equals(other.Count);
Exemple #9
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 = (VLRecipient)obj;

            //reference types
            if (!Object.Equals(m_recipientKey, other.m_recipientKey))
            {
                return(false);
            }
            if (!Object.Equals(m_email, other.m_email))
            {
                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_title, other.m_title))
            {
                return(false);
            }
            if (!Object.Equals(m_customValue, other.m_customValue))
            {
                return(false);
            }
            if (!Object.Equals(m_personalPassword, other.m_personalPassword))
            {
                return(false);
            }
            //value types
            if (!m_recipientId.Equals(other.m_recipientId))
            {
                return(false);
            }
            if (!m_collector.Equals(other.m_collector))
            {
                return(false);
            }
            if (!m_status.Equals(other.m_status))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }
            if (!m_activationDate.Equals(other.m_activationDate))
            {
                return(false);
            }
            if (!m_validFromDate.Equals(other.m_validFromDate))
            {
                return(false);
            }
            if (!m_validToDate.Equals(other.m_validToDate))
            {
                return(false);
            }
            if (!m_expireAfter.Equals(other.m_expireAfter))
            {
                return(false);
            }
            if (!m_expirationDate.Equals(other.m_expirationDate))
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// Adds a new turtle feature owned by current user.
        /// </summary>
        private async void AddButton_Click(object sender, RoutedEventArgs e)
        {
            var    layer   = MyMapView.Map.Layers["Marine"] as FeatureLayer;
            var    table   = (ArcGISFeatureTable)layer.FeatureTable;
            var    typeID  = (Int32)((Button)sender).Tag;
            string message = null;

            try
            {
                var mapPoint = await MyMapView.Editor.RequestPointAsync();

                var feature = new GeodatabaseFeature(table.Schema)
                {
                    Geometry = mapPoint
                };
                if (table.ServiceInfo.Types == null)
                {
                    return;
                }
                var featureType = table.ServiceInfo.Types.FirstOrDefault(t => Int32.Equals(Convert.ToInt32(t.ID, CultureInfo.InvariantCulture), typeID));
                if (featureType == null)
                {
                    return;
                }
                var template = featureType.Templates.FirstOrDefault();
                if (template == null || template.Prototype == null || template.Prototype.Attributes == null)
                {
                    return;
                }
                foreach (var item in template.Prototype.Attributes)
                {
                    feature.Attributes[item.Key] = item.Value;
                }
                if (table.CanAddFeature(feature))
                {
                    table.AddAsync(feature);
                }
                if (table.HasEdits)
                {
                    if (table is ServiceFeatureTable)
                    {
                        var serviceTable = (ServiceFeatureTable)table;
                        // Pushes new feature back to the server.
                        var result = await serviceTable.ApplyEditsAsync();

                        if (result.AddResults == null || result.AddResults.Count < 1)
                        {
                            return;
                        }
                        var addResult = result.AddResults[0];
                        if (addResult.Error != null)
                        {
                            message = addResult.Error.Message;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            if (!string.IsNullOrWhiteSpace(message))
            {
                await new MessageDialog(message).ShowAsync();
            }
        }
        /// <summary>
        /// funcion integra facturas
        /// </summary>
        /// <param name="oForm"></param>
        private static void IntegracionServicio(SAPbouiCOM.Form oForm)
        {
            //DTE objDTE = null;
            SAPbobsCOM.Documents oDoc    = null;
            SAPbouiCOM.Matrix    oMatrix = null;
            string Descripcion           = string.Empty;
            string Cuenta = string.Empty;
            string Dim1   = string.Empty;
            string Dim2   = string.Empty;
            string Dim3   = string.Empty;
            string Dim4   = string.Empty;
            string Dim5   = string.Empty;

            string RutEmisor = String.Empty;
            string Tipo      = String.Empty;
            string Folio     = String.Empty;
            string FebId     = String.Empty;
            string CardCode  = String.Empty;
            string FchEmis   = String.Empty;
            string FchVenc   = String.Empty;
            string MntTotal  = String.Empty;
            string IVA       = String.Empty;
            string NroRef    = null;
            string RzRef     = null;

            SAPbobsCOM.Recordset oRecordset = null;
            bool blAcepComer = false;

            try
            {
                oMatrix    = oForm.Items.Item("MatrixIM").Specific;
                oRecordset = Conexion_SBO.m_oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                oRecordset.DoQuery("SELECT \"U_SentAcepC\" FROM \"@SEI_SETVALH\"");
                blAcepComer = (oRecordset.Fields.Item("U_SentAcepC").Value == "Y" ? true : false);
                for (int i = 1; i <= oMatrix.VisualRowCount; i++)
                {
                    Descripcion = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_0").Cells.Item(i).Specific).Value; // oForm.Items.Item("Item_1").Specific.Value.ToString();
                    Cuenta      = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_1").Cells.Item(i).Specific).Value;
                    Dim1        = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_2").Cells.Item(i).Specific).Value;
                    Dim2        = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_3").Cells.Item(i).Specific).Value;
                    Dim3        = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_4").Cells.Item(i).Specific).Value;
                    Dim4        = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_5").Cells.Item(i).Specific).Value;
                    Dim5        = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_6").Cells.Item(i).Specific).Value;

                    RutEmisor = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_7").Cells.Item(i).Specific).Value;
                    Tipo      = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_9").Cells.Item(i).Specific).Value;
                    Folio     = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_8").Cells.Item(i).Specific).Value;
                    FebId     = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_10").Cells.Item(i).Specific).Value;
                    CardCode  = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_11").Cells.Item(i).Specific).Value;
                    FchEmis   = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_FEmis").Cells.Item(i).Specific).Value;
                    FchVenc   = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_FVenc").Cells.Item(i).Specific).Value;
                    MntTotal  = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_Total").Cells.Item(i).Specific).Value;
                    IVA       = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_IVA").Cells.Item(i).Specific).Value;

                    NroRef = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_1-1").Cells.Item(i).Specific).Value;
                    RzRef  = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_1-4").Cells.Item(i).Specific).Value;
                    ResultMessage rslt = FuncionesComunes.ValidacionDTEIntegrado(RutEmisor, Int32.Parse(Tipo), Folio);// Int64.Parse(Folio));
                    rslt.Success = true;
                    if (rslt.Success)
                    {
                        //objDTE = ListaDTEMatrix.ListaDTE.Where(x => x.FebosID == FebId).Select(x => x.objDTE).SingleOrDefault();
                        //if (objDTE != null)
                        //{
                        switch (Tipo)
                        {
                        case "33":
                            oDoc = (SAPbobsCOM.Documents)Conexion_SBO.m_oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseInvoices);
                            break;

                        case "34":
                            oDoc = (SAPbobsCOM.Documents)Conexion_SBO.m_oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseInvoices);
                            break;

                        case "56":
                            oDoc = (SAPbobsCOM.Documents)Conexion_SBO.m_oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseInvoices);
                            break;

                        case "61":
                            oDoc = (SAPbobsCOM.Documents)Conexion_SBO.m_oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes);
                            break;
                        }

                        oDoc.CardCode = CardCode;
                        //oDoc.CardName = FuncionesComunes.ObtenerCardName(RutEmisor, oDoc.CardCode);
                        switch (Tipo)
                        {
                        case "33":
                            oDoc.DocObjectCode = SAPbobsCOM.BoObjectTypes.oPurchaseInvoices;
                            break;

                        case "34":
                            oDoc.DocObjectCode = SAPbobsCOM.BoObjectTypes.oPurchaseInvoices;
                            break;

                        case "52":
                            oDoc.DocObjectCode = SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes;
                            break;

                        case "56":
                            oDoc.DocObjectCode = SAPbobsCOM.BoObjectTypes.oPurchaseInvoices;
                            break;

                        case "61":
                            oDoc.DocObjectCode = SAPbobsCOM.BoObjectTypes.oPurchaseCreditNotes;
                            break;

                        default:
                            oDoc.DocObjectCode = SAPbobsCOM.BoObjectTypes.oPurchaseInvoices;
                            break;
                        }

                        oDoc.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Service;

                        oDoc.DocDate           = Convert.ToDateTime(FchEmis);
                        oDoc.DocDueDate        = Convert.ToDateTime(FchVenc);
                        oDoc.DocTotal          = Convert.ToDouble(MntTotal);
                        oDoc.FolioNumber       = Convert.ToInt32(Folio);
                        oDoc.FolioPrefixString = Tipo;
                        oDoc.Indicator         = Tipo;
                        oDoc.UserFields.Fields.Item("U_SEI_FEBOSID").Value = FebId;


                        if (RzRef.Length > 254)
                        {
                            RzRef         = RzRef.Substring(0, 253);
                            oDoc.Comments = RzRef;
                        }
                        else
                        {
                            oDoc.Comments = RzRef;
                        }

                        if (NroRef.Length > 99)
                        {
                            NroRef         = NroRef.Substring(0, 98);
                            oDoc.NumAtCard = NroRef;
                        }
                        else
                        {
                            oDoc.NumAtCard = NroRef;
                        }
                        //oDoc.Comments = RzRef;

                        oDoc.Lines.ItemDescription = Descripcion.PadRight(99);
                        oDoc.Lines.AccountCode     = Cuenta;
                        oDoc.Lines.LineTotal       = Convert.ToDouble(Convert.ToDouble(MntTotal) - Convert.ToDouble(IVA));
                        switch (Tipo)
                        {
                        case "34":
                            oDoc.Lines.TaxCode = "IVA_EXE";
                            break;

                        default:

                            break;
                        }

                        if (!string.IsNullOrEmpty(Dim1))
                        {
                            oDoc.Lines.CostingCode = Dim1;
                        }
                        if (!string.IsNullOrEmpty(Dim2))
                        {
                            oDoc.Lines.CostingCode2 = Dim2;
                        }
                        if (!string.IsNullOrEmpty(Dim3))
                        {
                            oDoc.Lines.CostingCode3 = Dim3;
                        }
                        if (!string.IsNullOrEmpty(Dim4))
                        {
                            oDoc.Lines.CostingCode4 = Dim4;
                        }
                        if (!string.IsNullOrEmpty(Dim5))
                        {
                            oDoc.Lines.CostingCode5 = Dim5;
                        }


                        Int32  RetVal  = oDoc.Add();
                        String Mensaje = String.Empty;
                        if (RetVal.Equals(0))
                        {
                            rslt.Success = true;
                            //rslt = FuncionesComunes.EnviarRespuestaComercial(FebId, "ACD", String.Empty, String.Empty);
                            if (rslt.Success)
                            {
                                Conexion_SBO.m_SBO_Appl.StatusBar.SetText("Exito: El DTE :" + Folio + " Tipo :" + Tipo + " de :" + RutEmisor, SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                                // Aceptacion comercial

                                if (blAcepComer)
                                {
                                    rslt.Success = true;
                                    //rslt = FuncionesComunes.EnviarRespuestaComercial(FebId, "ACD", String.Empty, String.Empty);
                                    if (rslt.Success)
                                    {
                                        Conexion_SBO.m_SBO_Appl.StatusBar.SetText(String.Format("Exito: El DTE {0} Tipo {1} de {2}-{3} Se integro.", Folio, Tipo, RutEmisor), SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                                    }
                                    else
                                    {
                                        Conexion_SBO.m_SBO_Appl.StatusBar.SetText(String.Format("Reparo: El DTE {0} Tipo {1} de {2}-{3} Se integro, pero no se completo proceso de intercambio.", Folio, Tipo, RutEmisor), SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                                    }
                                }
                            }
                            else
                            {
                                Conexion_SBO.m_SBO_Appl.StatusBar.SetText("Reparo: El DTE :" + Folio + " Tipo :" + Tipo + " de :" + RutEmisor + " Se integro, pero no se completo proceso de intercambio.", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                                //file.WriteLine(String.Format("Reparo: El DTE {0} Tipo {1} de {2}-{3} Se integro, pero no se completo proceso de intercambio.", objDTE.IdDoc.Folio, objDTE.IdDoc.TipoDTE, objDTE.Emisor.RznSoc, objDTE.Emisor.RUTEmisor));
                            }
                        }
                        else
                        {
                            Int32  ErrCode = 0;
                            String ErrMsj  = String.Empty;
                            Conexion_SBO.m_oCompany.GetLastError(out ErrCode, out ErrMsj);
                            Conexion_SBO.m_SBO_Appl.StatusBar.SetText("Error: El DTE :" + Folio + " Tipo :" + Tipo + " de :" + RutEmisor + " No se integro " + ErrMsj, SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                            //file.WriteLine(String.Format("Error: El DTE {0} Tipo {1} de {2}-{3} No se integro. {4}", objDTE.IdDoc.Folio, objDTE.IdDoc.TipoDTE, objDTE.Emisor.RznSoc, objDTE.Emisor.RUTEmisor, ErrMsj));
                        }
                        //}
                    }
                }
            }
            catch (Exception ex)
            {
                Conexion_SBO.m_SBO_Appl.StatusBar.SetText("Error: " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                // FuncionesComunes.LiberarObjetoGenerico(objDTE);
                FuncionesComunes.LiberarObjetoGenerico(oDoc);
            }
        }
        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 = (VLClient)obj;

            //reference types
            if (!Object.Equals(m_code, other.m_code))
            {
                return(false);
            }
            if (!Object.Equals(m_name, other.m_name))
            {
                return(false);
            }
            if (!Object.Equals(m_profession, other.m_profession))
            {
                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_webSite, other.m_webSite))
            {
                return(false);
            }
            if (!Object.Equals(m_comment, other.m_comment))
            {
                return(false);
            }
            //value types
            if (!m_clientId.Equals(other.m_clientId))
            {
                return(false);
            }
            if (!m_country.Equals(other.m_country))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }
            if (!m_profile.Equals(other.m_profile))
            {
                return(false);
            }
            if (!m_folderSequence.Equals(other.m_folderSequence))
            {
                return(false);
            }

            return(true);
        }
Exemple #13
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,
            };
            Int32[] expectedValues =
            {
                1,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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_498yd! Uncaught Exception in Int32 Convert.ToInt32( Boolean )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Char");
        }
        try {
            Char[] testValues =
            {
                Char.MaxValue,
                Char.MinValue,
            };
            Int32[] expectedValues =
            {
                (Int32)Char.MaxValue,
                (Int32)Char.MinValue,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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 Int32 Convert.ToInt32( Char )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Double");
        }
        try {
            Double[] testValues =
            {
                100.0,
                -100.0,
                0,
            };
            Int32[] expectedValues =
            {
                100,
                -100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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,
                Double.MinValue,
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    Int32 result = Convert.ToInt32(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_489xy! Uncaught Exception in Int32 Convert.ToInt32( Double )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Single");
        }
        try {
            Single[] testValues =
            {
                100.0f,
                -100.0f,
                0.0f,
            };
            Int32[] expectedValues =
            {
                100,
                -100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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]);
                    }
                    Int32 result = Convert.ToInt32(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_498zy! Uncaught Exception in Int32 Convert.ToInt32( Single )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Int16");
        }
        try {
            Int16[] testValues =
            {
                100,
                (Int16)(-100),
                0,
            };
            Int32[] expectedValues =
            {
                100,
                -100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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);
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_4098g! Uncaught Exception in Int32 Convert.ToInt32( Int32 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Int64");
        }
        try {
            Int64[] testValues =
            {
                100,
                -100,
                0,
            };
            Int32[] expectedValues =
            {
                100,
                -100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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]);
                    }
                    Int32 result = Convert.ToInt32(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_908gy! Uncaught Exception in Int32 Convert.ToInt32( 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),
            };
            Int32[] expectedValues =
            {
                100,
                -100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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]);
                    }
                    Int32 result = Convert.ToInt32(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_909vy! Uncaught Exception in Int32 Convert.ToInt32( Decimal )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: String");
        }
        try {
            String[] testValues =
            {
                "100",
                "-100",
                "0",
                null,
            };
            Int32[] expectedValues =
            {
                100,
                -100,
                0,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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 =
            {
                Int64.MaxValue.ToString(),
                Int64.MinValue.ToString(),
                "abba",
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    Int32 result = Convert.ToInt32(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_7489s! Uncaught Exception in Int32 Convert.ToInt32( String )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: String");
        }
        try {
            String[] testValues =
            {
                "100",
                "-100",
                "0",
                null,
            };
            Int32[] expectedValues =
            {
                100,
                -100,
                0,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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 =
            {
                Int64.MaxValue.ToString(),
                Int64.MinValue.ToString(),
                "abba",
            };
            for (int i = 0; i < expectedExceptions.Length; i++)
            {
                iCountTestcases++;
                try {
                    if (verbose)
                    {
                        Console.WriteLine(" Exception Testing: " + expectedExceptions[i]);
                    }
                    Int32 result = Convert.ToInt32(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_7489s! Uncaught Exception in Int32 Convert.ToInt32( String )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Byte");
        }
        try {
            Byte[] testValues =
            {
                Byte.MaxValue,
                Byte.MinValue,
            };
            Int32[] expectedValues =
            {
                255,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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_4092s! Uncaught Exception in Int32 Convert.ToInt32( Byte )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: String, Int32");
        }
        try {
            String [] dummy  = { null, };
            Int32     result = Convert.ToInt32(dummy[0], 10);
            if (result != 0)
            {
                iCountErrors++;
                strLoc = "Err_xstri2A1";
                Console.Error.WriteLine(strLoc + " No Exception Thrown.");
            }
            result = Convert.ToInt32(dummy[0], 2);
            if (result != 0)
            {
                iCountErrors++;
                strLoc = "Err_xstri2A1";
                Console.Error.WriteLine(strLoc + " No Exception Thrown.");
            }
            result = Convert.ToInt32(dummy[0], 8);
            if (result != 0)
            {
                iCountErrors++;
                strLoc = "Err_xstri2A1";
                Console.Error.WriteLine(strLoc + " No Exception Thrown.");
            }
            result = Convert.ToInt32(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 =
            {
                "7FFFFFFF",
                "2147483647",
                "17777777777",
                "1111111111111111111111111111111",
                "80000000",
                "-2147483648",
                "20000000000",
                "10000000000000000000000000000000",
            };
            Int32[] testBases =
            {
                16,
                10,
                8,
                2,
                16,
                10,
                8,
                2,
            };
            Int32[] expectedValues =
            {
                Int32.MaxValue,
                Int32.MaxValue,
                Int32.MaxValue,
                Int32.MaxValue,
                Int32.MinValue,
                Int32.MinValue,
                Int32.MinValue,
                Int32.MinValue,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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]);
                    }
                    Int32 result = Convert.ToInt32(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_986yb! Uncaught Exception in Int32 Convert.ToInt32( str2int )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: SByte");
        }
        try {
            SByte[] testValues =
            {
                100,
                -100,
                0,
            };
            Int32[] expectedValues =
            {
                100,
                -100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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 Int32 Convert.ToInt32( SByte )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: UInt16");
        }
        try {
            UInt16[] testValues =
            {
                100,
                0,
            };
            Int32[] expectedValues =
            {
                100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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);
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_98987! Uncaught Exception in Int32 Convert.ToInt32( UInt16 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: UInt32");
        }
        try {
            UInt32[] testValues =
            {
                100,
                0,
            };
            Int32[] expectedValues =
            {
                100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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]);
                    }
                    Int32 result = Convert.ToInt32(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 Int32 Convert.ToInt32( UInt32 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: UInt64");
        }
        try {
            UInt64[] testValues =
            {
                100,
                0,
            };
            Int32[] expectedValues =
            {
                100,
                0,
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(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]);
                    }
                    Int32 result = Convert.ToInt32(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 Int32 Convert.ToInt32( UInt64 )");
            Console.WriteLine("Exception->" + e.GetType().FullName);
        }
        if (verbose)
        {
            Console.WriteLine("Testing Method: Int32");
        }
        try {
            Int32[] testValues =
            {
                Int32.MaxValue, Int32.MinValue, 0
            };
            Int32[] expectedValues =
            {
                Int32.MaxValue, Int32.MinValue, 0
            };
            for (int i = 0; i < testValues.Length; i++)
            {
                iCountTestcases++;
                if (verbose)
                {
                    Console.Write("Testing " + testValues[i] + " ==> ");
                }
                try {
                    Int32 result = Convert.ToInt32(testValues[i]);
                    if (verbose)
                    {
                        Console.WriteLine("'" + expectedValues[i] + "' == '" + result + "'");
                    }
                    if (!result.Equals(expectedValues[i]))
                    {
                        iCountErrors++;
                        strLoc = "Err_vInt32Ar," + i;
                        Console.Error.WriteLine(strLoc + " Expected = '" + expectedValues[i] + "' ... Received = '" + result + "'.");
                    }
                } catch (Exception e) {
                    iCountErrors++;
                    strLoc = "Err_xInt32Ar," + i;
                    Console.Error.WriteLine(strLoc + " Exception Thrown: " + e.GetType().FullName);
                }
            }
        } catch (Exception e) {
            iCountErrors++;
            Console.WriteLine("Error_4789y! Uncaught Exception in Byte Convert.ToInt32( Int32 )");
            Console.WriteLine("Exception->" + e.GetType().ToString());
        }
        strLoc = "Err_dew452,";
        try
        {
            iCountTestcases++;
            Int32 bTest = Convert.ToInt32(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++;
            Int32 bTest = Convert.ToInt32(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++;
            Int32 bTest = Convert.ToInt32(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);
        }
    }
    public virtual bool runTest()
    {
        Console.Error.WriteLine("Co1612Cons_Eq_GV_GHC runTest started.");
        Console.Out.WriteLine("");
        Console.Out.WriteLine("Method_Covered: Integer4.Equals(Object obj)");
        Console.Out.WriteLine("Method_Covered: Integer4.GetValue ()");
        Console.Out.WriteLine("Method_Covered: Integer4.GetHashCode ()");
        Console.Out.WriteLine("Method_Count==3 (Co1612Cons_Eq_GV_GHC)");
        Console.Out.WriteLine("");
        String        strLoc          = "Loc_000oo";
        StringBuilder sblMsg          = new StringBuilder(99);
        int           iCountErrors    = 0;
        int           iCountTestcases = 0;
        String        str0            = null;
        String        str2            = null;
        StringBuilder sbl5            = new StringBuilder(99);
        int           in4z            = -2;
        int           in4y            = -2;
        Int16         int2a           = (Int16)0;
        Int32         int4a           = (Int32)0;
        Int32         int4b           = (Int32)0;

        try
        {
LABEL_860_GENERAL:
            do
            {
                in4z        = 3;   strLoc = "Loc_110th";
                sbl5.Length = 0;
                str0        = sbl5.Append(in4z).ToString();
                int4a       = (Int32)(in4z);
                int4b       = (Int32)(in4z);
                in4y        = int4a.GetHashCode();
                ++iCountTestcases;
                if (in4z != in4y)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_184pr!  in4y==" + in4y);
                }
                in4y = int4a;
                ++iCountTestcases;
                if (in4z != in4y)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_125ci!  in4y==" + in4y);
                }
                str2 = int4a.ToString();
                ++iCountTestcases;
                if (!str2.Equals(str0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_144ye!  str2==" + str2);
                }
                ++iCountTestcases;
                if (!int4a.Equals(int4b))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_199nd!  in4z==" + in4z);
                }
                in4z        = -4;   strLoc = "Loc_120tr";
                sbl5.Length = 0;
                str0        = sbl5.Append(in4z).ToString();
                int4a       = (Int32)(in4z);
                int4b       = (Int32)(in4z);
                in4y        = int4a.GetHashCode();
                ++iCountTestcases;
                if (in4z != -4)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_184zl!  -in4y==" + -in4y);
                }
                in4y = int4a;
                ++iCountTestcases;
                if (in4z != in4y)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_125wa!  in4y==" + in4y);
                }
                str2 = int4a.ToString();
                ++iCountTestcases;
                if (!str2.Equals(str0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_144dy!  str2==" + str2);
                }
                ++iCountTestcases;
                if (!int4a.Equals(int4b))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_199uc!  in4z==" + in4z);
                }
                in4z        = Int32.MinValue;   strLoc = "Loc_220nv";
                sbl5.Length = 0;
                str0        = sbl5.Append(in4z).ToString();
                int4a       = (Int32)(in4z);
                int4b       = (Int32)(in4z);
                in4y        = int4a.GetHashCode();
                ++iCountTestcases;
                if (in4z == 0)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_284pr!  ( -in4y + 1 )==" + (-in4y + 1));
                }
                in4y = int4a;
                ++iCountTestcases;
                if (in4z != in4y)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_225ci!  in4y==" + in4y);
                }
                str2 = int4a.ToString();
                ++iCountTestcases;
                if (!str2.Equals(str0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_244ye!  str2==" + str2);
                }
                ++iCountTestcases;
                if (!int4a.Equals(int4b))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_299nd!  in4z==" + in4z);
                }
                in4z        = Int32.MaxValue;   strLoc = "Loc_330xv";
                sbl5.Length = 0;
                str0        = sbl5.Append(in4z).ToString();
                int4a       = (Int32)(in4z);
                int4b       = (Int32)(in4z);
                in4y        = int4a.GetHashCode();
                ++iCountTestcases;
                if (in4z != in4y)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_384pr!  in4y==" + in4y);
                }
                in4y = int4a;
                ++iCountTestcases;
                if (in4z != in4y)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_325ci!  in4y==" + in4y);
                }
                str2 = int4a.ToString();
                ++iCountTestcases;
                if (!str2.Equals(str0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_344ye!  str2==" + str2);
                }
                ++iCountTestcases;
                if (!int4a.Equals(int4b))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_399nd!  in4z==" + in4z);
                }
                in4z        = -0;   strLoc = "Loc_440nz";
                sbl5.Length = -0;
                str0        = sbl5.Append(in4z).ToString();
                int4a       = (Int32)(in4z);
                int4b       = (Int32)(in4z);
                in4y        = int4a.GetHashCode();
                ++iCountTestcases;
                if (in4z != in4y)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_484pr!  in4y==" + in4y);
                }
                in4y = int4a;
                ++iCountTestcases;
                if (in4z != in4y)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_425ci!  in4y==" + in4y);
                }
                str2 = int4a.ToString();
                ++iCountTestcases;
                if (!str2.Equals(str0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_444ye!  str2==" + str2);
                }
                ++iCountTestcases;
                if (!int4a.Equals(int4b))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_499nd!  in4z==" + in4z);
                }
                ++iCountTestcases;
                if (!str2.Equals("0"))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_461vj!  str2==" + str2);
                }
                int2a = (Int16)((short)-0);
                ++iCountTestcases;
                if (!int4a.Equals(int2a))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK: Error Err_462mj!  int2a.ToString()==" + int2a.ToString());
                }
            } while (false);
        }
        catch (Exception exc_general)
        {
            ++iCountErrors;
            Console.Error.WriteLine("POINTTOBREAK: Error Err_343un! (Co1612Cons_Eq_GV_GHC) exc_general==" + exc_general);
            Console.Error.WriteLine("EXTENDEDINFO: (Err_343un) strLoc==" + strLoc);
        }
        if (iCountErrors == 0)
        {
            Console.Error.WriteLine("paSs.   Integer4\\Co1612Cons_Eq_GV_GHC.cs   iCountTestcases==" + iCountTestcases);
            return(true);
        }
        else
        {
            Console.Error.WriteLine("FAiL!   Integer4\\Co1612Cons_Eq_GV_GHC.cs   iCountErrors==" + iCountErrors);
            return(false);
        }
    }
Exemple #15
0
 public override bool Equals(int x, int y)
 {
     return(Int32.Equals(x, y));
 }
Exemple #16
0
 public override bool Equals(object other)
 {
     return(ReferenceEquals(other, null) && !hasValue ||
            value.Equals(other));
 }
        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 = (VLKnownEmail)obj;

            //reference types
            if (!Object.Equals(m_emailAddress, other.m_emailAddress))
            {
                return(false);
            }
            if (!Object.Equals(m_localPart, other.m_localPart))
            {
                return(false);
            }
            if (!Object.Equals(m_domainPart, other.m_domainPart))
            {
                return(false);
            }
            //value types
            if (!m_client.Equals(other.m_client))
            {
                return(false);
            }
            if (!m_emailId.Equals(other.m_emailId))
            {
                return(false);
            }
            if (!m_registerDt.Equals(other.m_registerDt))
            {
                return(false);
            }
            if (!m_isDomainOK.Equals(other.m_isDomainOK))
            {
                return(false);
            }
            if (!m_isVerified.Equals(other.m_isVerified))
            {
                return(false);
            }
            if (!m_isOptedOut.Equals(other.m_isOptedOut))
            {
                return(false);
            }
            if (!m_isBounced.Equals(other.m_isBounced))
            {
                return(false);
            }
            if (!m_verifiedDt.Equals(other.m_verifiedDt))
            {
                return(false);
            }
            if (!m_optedOutDt.Equals(other.m_optedOutDt))
            {
                return(false);
            }

            return(true);
        }