public void Handle_SameLegalName_NoAliasAdded()
        {
            AgencyName agencyName = new AgencyName("TestAgencyName", "DisplayName", "BusinessName");

            AgencyProfile agencyProfile = new AgencyProfile (
                new Mock<AgencyType> ().Object,
                agencyName,
                new DateRange ( DateTime.Now.AddDays ( -1 ), DateTime.Now ),
                "url",
                new Mock<GeographicalRegion> ().Object,
                "note" );

            var aliasAdded = false;

            var agencyMock = new Mock<Agency>();
            agencyMock.SetupGet(p => p.AgencyProfile).Returns(agencyProfile);
            agencyMock.Setup(a => a.AddAgencyAlias(It.IsAny<AgencyAlias>())).Callback(() => aliasAdded = true);

            var agencyProfileChangedEvent = new Mock<AgencyProfileChangedEvent>();
            agencyProfileChangedEvent.SetupGet(p => p.Agency).Returns(agencyMock.Object);
            agencyProfileChangedEvent.SetupGet(p => p.OldAgencyProfile).Returns(agencyProfile);

            new AgencyProfileChangedEventHandler().Handle(agencyProfileChangedEvent.Object);

            Assert.IsFalse(aliasAdded);
        }
        public void Handle_SameLegalName_NoAliasAdded()
        {
            AgencyName agencyName = new AgencyName("TestAgencyName", "DisplayName", "BusinessName");

            AgencyProfile agencyProfile = new AgencyProfile(
                new Mock <AgencyType> ().Object,
                agencyName,
                new DateRange(DateTime.Now.AddDays(-1), DateTime.Now),
                "url",
                new Mock <GeographicalRegion> ().Object,
                "note");

            var aliasAdded = false;

            var agencyMock = new Mock <Agency>();

            agencyMock.SetupGet(p => p.AgencyProfile).Returns(agencyProfile);
            agencyMock.Setup(a => a.AddAgencyAlias(It.IsAny <AgencyAlias>())).Callback(() => aliasAdded = true);

            var agencyProfileChangedEvent = new Mock <AgencyProfileChangedEvent>();

            agencyProfileChangedEvent.SetupGet(p => p.Agency).Returns(agencyMock.Object);
            agencyProfileChangedEvent.SetupGet(p => p.OldAgencyProfile).Returns(agencyProfile);

            new AgencyProfileChangedEventHandler().Handle(agencyProfileChangedEvent.Object);

            Assert.IsFalse(aliasAdded);
        }
Esempio n. 3
0
        /// <summary>
        /// Returns true if AgencyCosting instances are equal
        /// </summary>
        /// <param name="other">Instance of AgencyCosting to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AgencyCosting other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AgencyId == other.AgencyId ||
                     AgencyId != null &&
                     AgencyId.Equals(other.AgencyId)
                     ) &&
                 (
                     AgencyName == other.AgencyName ||
                     AgencyName != null &&
                     AgencyName.Equals(other.AgencyName)
                 ) &&
                 (
                     Cost == other.Cost ||

                     Cost.Equals(other.Cost)
                 ));
        }
        public void WriteXMLToFields(XElement root)
        {
            AgencyName.Write(root.Element("AgencyName").Value);
            EmployeeName.Write(root.Element("NomineeName").Value);
            EmployeeClassTitle.Write(root.Element("ClassTitle").Value);
            EmployeeDivision.Write(root.Element("Division").Value);
            switch (root.Element("ComponentViewName").Value)
            {
            case "GoodConduct":
                SpecialAchievementAward.Write("X");
                GrantOfLeave.Write("X");
                GrantOfLeaveCount.Write("2");
                OtherRecognition.Write("X");
                OtherRecognitionSpecified.Write("Award Ribbon");
                GoodConductAppraisalMinimumRatingRequirement.Write("X");
                GoodConductApprovalObtained.Write("X");
                GoodConductApprovalObtainedDate.Write(Convert.ToDateTime(root.Element("EligibilityConfirmationDate").Value).ToString("MM/dd/yy"));
                break;

            case "Exemplary":
                ExemplaryPerformanceAward.Write("X");
                ExemplaryPerformanceDateRange.Write($"{Convert.ToDateTime(root.Element("StartDate").Value).ToString("MM/yy")} - {Convert.ToDateTime(root.Element("EndDate").Value).ToString("MM/yy")}");
                GrantOfLeave.Write("X");
                GrantOfLeaveCount.Write(root.Element("SelectedAwardType").Value);
                switch (root.Element("SelectedAwardType").Value)
                {
                case "1":
                    OutstandingPerformance1.Write("X");
                    break;

                case "2":
                    OutstandingPerformance2.Write("X");
                    break;

                case "3":
                    OutstandingPerformance3.Write("X");
                    break;
                }
                break;

            default:
                throw new NotImplementedException("The Award Type specified in the XML Form Data is not recognized.");
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (AgencyId != null)
                {
                    hashCode = hashCode * 59 + AgencyId.GetHashCode();
                }
                if (AgencyName != null)
                {
                    hashCode = hashCode * 59 + AgencyName.GetHashCode();
                }

                hashCode = hashCode * 59 + Cost.GetHashCode();
                return(hashCode);
            }
        }