Ejemplo n.º 1
0
        public CheckResult Compare(GroupData otherGroupData)
        {
            if (null == otherGroupData)
            {
                otherGroupData = new GroupData
                {
                    GroupFooter = null,
                    GroupHeader = null,
                    GroupName   = null
                };
            }

            CheckResult          retval         = new CheckResult();
            ObjectComparePrinter comparePrinter = new ObjectComparePrinter("GroupData");

            comparePrinter.AddPairOfValuesDiff("GroupName", otherGroupData.GroupName, GroupName);
            comparePrinter.AddPairOfValuesDiff("GroupHeader", otherGroupData.GroupHeader, GroupHeader);
            comparePrinter.AddPairOfValuesDiff("GroupFooter", otherGroupData.GroupFooter, GroupFooter);
            retval.Message = comparePrinter.PrintListOfPropertiesSideBySide();
            retval.Result  = IsValidGroupDataEqual(otherGroupData);
            return(retval);
        }
Ejemplo n.º 2
0
        protected CheckResultSet CormpareTwoModelLists <T>(List <T> listFirst, List <T> listSecond,
                                                           Func <T, T, CheckResult> compareAndGetTestResult)
        {
            CheckResultSet retval            = new CheckResultSet();
            CheckResult    compareListLength = CompareListLength(listFirst, listSecond);

            retval.Add(compareListLength);
            List <T> longestList  = listSecond.Count >= listFirst.Count ? listSecond : listFirst;
            List <T> shortestList = listSecond.Count < listFirst.Count ? listSecond : listFirst;

            for (int i = 0; i < longestList.Count; i++)
            {
                T elementToCompare = default(T);
                if (i < shortestList.Count)
                {
                    elementToCompare = shortestList[i];
                }

                CheckResult currentCheckResult = compareAndGetTestResult(longestList[i], elementToCompare);
                retval.Add(currentCheckResult);
            }
            return(retval);
        }
 public CheckResultSet Add(CheckResult result)
 {
     _resultSetList.Add(result);
     return(this);
 }
Ejemplo n.º 4
0
        public CheckResult Compare(ContactData otherContactData)
        {
            if (null == otherContactData)
            {
                otherContactData = new ContactData()
                {
                    Id               = null,
                    FirstName        = null,
                    MiddleName       = null,
                    LastName         = null,
                    Nickname         = null,
                    Photo            = null,
                    Title            = null,
                    Company          = null,
                    Address          = null,
                    TelephoneHome    = null,
                    TelephoneMobile  = null,
                    TelephoneWork    = null,
                    TelephoneFax     = null,
                    EMail            = null,
                    EMail2           = null,
                    EMail3           = null,
                    Homepage         = null,
                    Birthday         = null,
                    Anniversary      = null,
                    Group            = null,
                    Secondary        = null,
                    SecondaryAddress = null,
                    SecondaryHome    = null,
                    Notes            = null,
                };
            }

            CheckResult          retval         = new CheckResult();
            ObjectComparePrinter comparePrinter = new ObjectComparePrinter("GroupData");

            comparePrinter.AddPairOfValuesDiff("Id", otherContactData.Id, Id);
            comparePrinter.AddPairOfValuesDiff("FirstName", otherContactData.FirstName, FirstName);
            comparePrinter.AddPairOfValuesDiff("MiddleName", otherContactData.MiddleName, MiddleName);
            comparePrinter.AddPairOfValuesDiff("LastName", otherContactData.LastName, LastName);
            comparePrinter.AddPairOfValuesDiff("Nickname", otherContactData.Nickname, Nickname);
            comparePrinter.AddPairOfValuesDiff("Photo", otherContactData.Photo, Photo);
            comparePrinter.AddPairOfValuesDiff("Title", otherContactData.Title, Title);
            comparePrinter.AddPairOfValuesDiff("Company", otherContactData.Company, Company);
            comparePrinter.AddPairOfValuesDiff("Address", otherContactData.Address, Address);
            comparePrinter.AddPairOfValuesDiff("TelephoneString", otherContactData.TelephoneString, TelephoneString);
//            comparePrinter.AddPairOfValuesDiff("TelephoneHome", otherContactData.TelephoneHome, TelephoneHome);
//            comparePrinter.AddPairOfValuesDiff("TelephoneMobile", otherContactData.TelephoneMobile, TelephoneMobile);
//            comparePrinter.AddPairOfValuesDiff("TelephoneWork", otherContactData.TelephoneWork, TelephoneWork);
            comparePrinter.AddPairOfValuesDiff("TelephoneFax", otherContactData.TelephoneFax, TelephoneFax);
            comparePrinter.AddPairOfValuesDiff("EMailString", otherContactData.EMailString, EMailString);
//            comparePrinter.AddPairOfValuesDiff("EMail", otherContactData.EMail, EMail);
//            comparePrinter.AddPairOfValuesDiff("EMail2", otherContactData.EMail2, EMail2);
//            comparePrinter.AddPairOfValuesDiff("EMail3", otherContactData.EMail3, EMail3);
            comparePrinter.AddPairOfValuesDiff("Homepage", otherContactData.Homepage, Homepage);
            comparePrinter.AddPairOfValuesDiff("Birthday", otherContactData.Birthday, Birthday);
            comparePrinter.AddPairOfValuesDiff("Anniversary", otherContactData.Anniversary, Anniversary);
            comparePrinter.AddPairOfValuesDiff("Group", otherContactData.Group, Group);
            comparePrinter.AddPairOfValuesDiff("Secondary", otherContactData.Secondary, Secondary);
            comparePrinter.AddPairOfValuesDiff("SecondaryAddress", otherContactData.SecondaryAddress, SecondaryAddress);
            comparePrinter.AddPairOfValuesDiff("SecondaryHome", otherContactData.SecondaryHome, SecondaryHome);
            comparePrinter.AddPairOfValuesDiff("Notes", otherContactData.Notes, Notes);

            retval.Message = comparePrinter.PrintListOfPropertiesSideBySide();
            retval.Result  = IsValidContactDataEqual(otherContactData);
            if (!retval.Result)
            {
                int i = 0;
                i++;
            }
            return(retval);
        }