Esempio n. 1
0
        public void ShouldDeserializeApplicantAsExpected()
        {
            var applicant    = JsonConvert.DeserializeObject <Applicant>(ApplicantGenerator.Json());
            var applicantRef = ApplicantGenerator.Applicant(true);

            Assert.AreEqual(applicant.Id, applicantRef.Id);
            Assert.AreEqual(applicant.CreatedAt, applicantRef.CreatedAt);
            Assert.AreEqual(applicant.HRef, applicantRef.HRef);
            Assert.AreEqual(applicant.Title, applicantRef.Title);
            Assert.AreEqual(applicant.FirstName, applicantRef.FirstName);
            Assert.AreEqual(applicant.MiddleName, applicantRef.MiddleName);
            Assert.AreEqual(applicant.LastName, applicantRef.LastName);
            Assert.AreEqual(applicant.Gender, applicantRef.Gender);
            Assert.AreEqual(applicant.DateOfBirth, applicantRef.DateOfBirth);
            Assert.AreEqual(applicant.Telephone, applicantRef.Telephone);
            Assert.AreEqual(applicant.Mobile, applicantRef.Mobile);
            Assert.AreEqual(applicant.Country, applicantRef.Country);

            Assert.AreEqual(applicant.IdNumbers.Count(), applicantRef.IdNumbers.Count());

            var ssn = new IdNumber {
                Type = "ssn", Value = "433-54-3937", StateCode = null
            };
            var driving_license = new IdNumber {
                Type = "driving_license", Value = "I1234562", StateCode = "CA"
            };
            var found_ssn             = false;
            var found_driving_license = false;

            foreach (var id in applicant.IdNumbers)
            {
                found_ssn             |= CompareIdNumbers(id, applicantRef.IdNumbers.First());
                found_driving_license |= CompareIdNumbers(id, applicantRef.IdNumbers.Last());
            }

            Assert.IsTrue(found_ssn);
            Assert.IsTrue(found_driving_license);

            var found_current_addr  = false;
            var found_previous_addr = false;

            foreach (var address in applicant.Addresses)
            {
                found_current_addr  |= CompareAddresses(address, applicantRef.Addresses.First());
                found_previous_addr |= CompareAddresses(address, applicantRef.Addresses.Last());
            }

            Assert.IsTrue(found_current_addr);
            Assert.IsTrue(found_previous_addr);
        }
Esempio n. 2
0
        public void CallService()
        {
            var applicant = ApplicantGenerator.Applicant(false);

            ApplicantService.Create(applicant);
        }