Ejemplo n.º 1
0
        public void TestAsPoco()
        {
            var dob        = Etx.RandomAdultBirthDate();
            var gender     = Gender.Female;
            var firstName  = AmericanUtil.RandomAmericanFirstName(gender, dob);
            var middleName = AmericanUtil.RandomAmericanFirstName(gender, dob);
            var lastName   = AmericanUtil.RandomAmericanLastName();

            var testSubject = new American
            {
                BirthCert  = new AmericanBirthCert(dob),
                Gender     = gender,
                FirstName  = firstName,
                LastName   = lastName,
                MiddleName = middleName
            };

            var addrLine1 = "4455 Deweier St.";
            var addrLine2 = "Huntington Beach, CA 90802";

            PostalAddress.TryParse(addrLine1, addrLine2, out var address);
            testSubject.AddAddress(address);

            Assert.AreEqual($"{firstName} {middleName} {lastName}", testSubject.FullName);
            Assert.IsNotNull(testSubject.Address);
            Assert.AreEqual($"{addrLine1}\r\n{addrLine2}", testSubject.Address.ToString());

            var phNum = "707-884-5563";

            NorthAmericanPhone.TryParse(phNum, out var naph);
            naph.Descriptor = KindsOfLabels.Mobile;
            testSubject.AddPhone(naph);

            var testResultPhone = testSubject.PhoneNumbers.FirstOrDefault(p => p.Descriptor == KindsOfLabels.Mobile);

            Assert.IsNotNull(testResultPhone as NorthAmericanPhone);
            var namerTestResultPhone = testResultPhone as NorthAmericanPhone;

            Assert.AreEqual("707", namerTestResultPhone.AreaCode);
            Assert.AreEqual("884", namerTestResultPhone.CentralOfficeCode);
            Assert.AreEqual("5563", namerTestResultPhone.SubscriberNumber);

            var testEmail = "*****@*****.**";

            testSubject.AddUri(testEmail);

            var testResultEmail = testSubject.NetUris.FirstOrDefault(u => u.Scheme == Uri.UriSchemeMailto);

            Assert.IsNotNull(testResultEmail);
            Assert.IsTrue(testResultEmail.ToString().EndsWith(testEmail));
        }