public void RecentInfoCommandService_CheckNotUsefulPersonData() { var recentInfoCommandService = GetDependency <IRecentInfoCommandService>(); Assert.IsInstanceOfType(recentInfoCommandService, typeof(IRecentInfoCommandService)); RecentPersonDetails recentPersonDetails = MockObjects.NewRecentPersonDetails; recentPersonDetails.LastName = null; Guid contributePersonId = recentInfoCommandService.ContributePerson(MockObjects.NewContributionDetails, RecentInfoType.FI, recentPersonDetails); Assert.AreEqual(contributePersonId, Guid.Empty); Assert.IsInstanceOfType(contributePersonId, typeof(Guid)); }
public Guid ContributePerson(ContributionDetails contributionDetails, RecentInfoType recentInfoType, RecentPersonDetails details) { purgeOldRecords("RecentPersons"); return(UsefulPersonData(details) ? ProcessContribution(contributionDetails, details, () => new RecentPerson(contributionDetails.As <Domain.RecentInfo.ValueObjects.ContributionDetails>(), recentInfoType)) : Guid.Empty); }
private bool Contribute_Person_Works() { using (var ioc = DependencyContainer.Resolve <IRecentInfoCommandService>()) { var data = new RecentPersonDetails() { Age = new CodeValue("25", "25"), Age2 = 35, AttorneyName = new CodeValue("ATT", "Attorney"), Build = new CodeValue("B", "Big"), DateOfBirth = DateTime.Now, Email = "*****@*****.**", Ethnicity = new CodeValue("Y", "Yes"), EyeColor = new CodeValue("7", "Yellow"), FacialHair = new CodeValue("YL", "Yes Lots"), FirstName = "John", Glasses = new CodeValue("Y", "Yes"), HairColor = new CodeValue("BRN", "Brown"), HairLength = new CodeValue("XXL", "2 Meters"), HairStyle = new CodeValue("B", "Bad"), Height = "123", JcaNumber = "JCA54321", LastName = "Vernacle", LicenseNumber = "5", LicenseState = new CodeValue("NC", "North Carolina"), MaritalStatus = new CodeValue("Y", "Yes"), MethodOfOperation = new CodeValue("Y", "Yes"), MiddleName = "Bart", MiscellaneousIdNumber = "7", MiscellaneousIdState = new CodeValue("Y", "Yes"), MiscellaneousIdType = new CodeValue("Y", "Yes"), Moniker = "Jimmy", OrganizationName = "Place I Work?", OrganizationType = new CodeValue("Y", "Yes"), Contact1 = new ContactInfo(new CodeValue("H", "Home"), "827388123"), Contact2 = new ContactInfo(new CodeValue("H", "Home"), "827388123"), Contact3 = new ContactInfo(new CodeValue("H", "Home"), "827388123"), PlaceOfBirth = new CodeValue("Y", "Yes"), //PrimaryAddress = HostTestService.NewLocation, Race = new CodeValue("Y", "Yes"), ResidentStatus = new CodeValue("Y", "Yes"), //SecondaryAddress = HostTestService.NewLocation, Sex = new CodeValue("Y", "Yes"), Skin = new CodeValue("Y", "Yes"), Ssn = "123456789", Suffix = "Jr.", Weight = 125 }; var svc = ioc.Instance; var contributionDetails = new ContributionDetails() { Contributor = "TEST", Agency = "TEST", ResourceId = Guid.NewGuid().ToString(), ResourceType = "Person", System = "InformRMSTest" }; var id = svc.ContributePerson(contributionDetails, RecentInfoType.MISC, data); return(id != Guid.Empty); } }
/// <summary> /// Return True if the Person data is useful. /// </summary> private static bool UsefulPersonData(RecentPersonDetails person) { return(person != null && !string.IsNullOrWhiteSpace(person.LastName) && !string.IsNullOrWhiteSpace(person.FirstName)); }