public override bool Equals(Object obj)
        {
            bool result = false;

            if (obj is ApprovedSoftware)
            {
                ApprovedSoftware testingSoftware = (ApprovedSoftware)obj;
                if (testingSoftware.ApprovedBy == ApprovedBy)
                {
                    result = testingSoftware.SoftwareExample.SoftwareCode.Equals(SoftwareExample.SoftwareCode);
                    switch (ApprovedBy)
                    {
                    case ApprovedByCodes.FULL_VERSION:
                        result = result &&
                                 testingSoftware.SoftwareExample.ProductVersionString.Equals(SoftwareExample.ProductVersionString);
                        break;

                    case ApprovedByCodes.MAJOR_VERSION:
                        result = result &&
                                 testingSoftware.SoftwareExample.MajorVersion == SoftwareExample.MajorVersion;
                        break;

                    case ApprovedByCodes.MAJOR_VERSION_OR_GREATER:
                        result = result &&
                                 testingSoftware.SoftwareExample.MajorVersion >= SoftwareExample.MajorVersion;
                        break;
                    }
                }
            }
            return(result);
        }
Exemple #2
0
        public void addSoftware(ApprovedSoftware.ApprovedByCodes approvedBy, Software software)
        {
            ApprovedSoftware approved = createApprovedSoftwareEntry(approvedBy, software);

            if (!approvalIsInList(approved))
            {
                ApprovedSoftwares.Add(approved);
            }
        }
Exemple #3
0
        private ApprovedSoftware createApprovedSoftwareEntry(ApprovedSoftware.ApprovedByCodes approvedBy, Software software)
        {
            ApprovedSoftware approved = new ApprovedSoftware()
            {
                ApprovedBy      = approvedBy,
                SoftwareExample = software
            };

            return(approved);
        }
Exemple #4
0
        private bool approvalIsInList(ApprovedSoftware testingEntry)
        {
            bool result = false;

            foreach (ApprovedSoftware approvedSoftware in ApprovedSoftwares)
            {
                if (approvedSoftware.Equals(testingEntry))
                {
                    result = true;
                    break;
                }
            }
            return(result);
        }
Exemple #5
0
        public bool removeSoftware(ApprovedSoftware toRemove)
        {
            ApprovedSoftware removingEntry = null;

            foreach (ApprovedSoftware approvedSoftware in ApprovedSoftwares)
            {
                if (approvedSoftware.Equals(toRemove))
                {
                    removingEntry = approvedSoftware;
                }
            }
            if (removingEntry != null)
            {
                ApprovedSoftwares.Remove(removingEntry);
            }
            return(removingEntry != null);
        }