public void PassportInfoModelTest()
        {
            var photoName = "1.jpg";

            var code = new Code("5013", "455999");

            var issueInfo = new PassportIssueInfo("ОУФМС РФ по НСО в Ленинском районе", "540-007",
                                                  new DateTime(2016, 1, 1));

            var fullName   = new FullName("Иванов", "Иван", "Иванович");
            var birthInfo  = new BirthInfo(new DateTime(1995, 1, 1), "НСО, г. Новосибирск");
            var personInfo = new PersonInfo(fullName, birthInfo);

            var registerLocation = new Address("НСО, г. Новосибирск, ул. Валдайская, д. 19/1");
            var actuallyLocation = new Address("НСО, г. Новосибирск, ул. Балдуйс, д. 1");
            var locality         = "г. Новосибирск";

            var locationInfo = new PassportLocationInfo(registerLocation, actuallyLocation, locality);

            var passportFamilyInfo = new PassportFamilyInfo(familyStatus: FamilyStatus.Single, isHaveBaby: true);

            var passportInfo = new PassportInfo(photoName, code, issueInfo, personInfo, locationInfo, passportFamilyInfo);

            Assert.AreEqual(photoName, passportInfo.PhotoName);
            Assert.AreEqual(code, passportInfo.Code);
            Assert.AreEqual(issueInfo, passportInfo.IssueInfo);
            Assert.AreEqual(personInfo, passportInfo.PersonInfo);
            Assert.AreEqual(locationInfo, passportInfo.LocationInfo);
            Assert.AreEqual(passportFamilyInfo, passportInfo.FamilyInfo);
        }
        public void PassportLocationInfoTest()
        {
            var region = "НСО";
            var city   = "г. Новосибирск";

            var street1 = "ул. Валдайская";
            var street2 = "ул. Балдуйс";
            var house1  = "д. 19/1";
            var house2  = "д. 1";

            var registerLocation = new Address($"{region} {city} {street1} {house1}");
            var actuallyLocation = new Address($"{region} {city} {street2} {house2}");
            var locality         = city;

            var locationInfo = new PassportLocationInfo(registerLocation, actuallyLocation, city);

            Assert.AreEqual(registerLocation, locationInfo.RegisterLocation);
            Assert.AreEqual(actuallyLocation, locationInfo.ActuallyLocation);
            Assert.AreEqual(locality, locationInfo.Locality);
        }
        private static PassportInfo BuildPassportInfo(priz priz)
        {
            DateTime?passportIssueDate = priz.d_pass.GetDateTime();

            if (!passportIssueDate.HasValue)
            {
                throw new ArgumentException(nameof(priz));
            }

            DateTime?birthdate = priz.born_date.GetDateTime();

            if (!birthdate.HasValue)
            {
                throw new ArgumentException(nameof(priz));
            }

            var photoName = priz.photo;

            var passportCode = new Code(priz.pass);

            var issueInfo = new PassportIssueInfo(issueBy: priz.g_pass,
                                                  devisionCode: priz.kod_g_pass,
                                                  issueDate: passportIssueDate.Value);

            var fullName  = new FullName(priz.surname, priz.name, priz.patr_name);
            var birthInfo = new BirthInfo(date: birthdate.Value,
                                          place: priz.born_place);

            var personInfo = new PersonInfo(fullName, birthInfo);

            var registerLocation = new Address(priz.register_location);
            var actuallyLocation = new Address(priz.actually_location);
            var locality         = priz.locality;

            var locationInfo = new PassportLocationInfo(registerLocation, actuallyLocation, locality);

            var passportFamilyInfo = new PassportFamilyInfo(familyStatus: priz.family_status.ToFamilyStatusEnum(),
                                                            isHaveBaby: priz.baby == PassportFamilyInfo.HaveBaby);

            return(new PassportInfo(photoName, passportCode, issueInfo, personInfo, locationInfo, passportFamilyInfo));
        }
Example #4
0
        private PassportInfo BuildPassportInfo()
        {
            var photoName = _firstCardGroup.PassportPersonInfoCard.PhotoName;

            var code = new Code(_firstCardGroup.PassportInfoCard.Code);

            if (!_firstCardGroup.PassportInfoCard.IssueDate.HasValue)
            {
                throw new NullReferenceException(nameof(_firstCardGroup.PassportInfoCard.IssueDate));
            }

            var issueInfo = new PassportIssueInfo(_firstCardGroup.PassportInfoCard.IssueBy,
                                                  _firstCardGroup.PassportInfoCard.DevisionCode,
                                                  _firstCardGroup.PassportInfoCard.IssueDate.Value);

            var fullName = new FullName(_firstCardGroup.PassportPersonInfoCard.Surname,
                                        _firstCardGroup.PassportPersonInfoCard.Name,
                                        _firstCardGroup.PassportPersonInfoCard.Patronymic);

            if (!_firstCardGroup.PassportPersonInfoCard.BirthDate.HasValue)
            {
                throw new NullReferenceException(nameof(_firstCardGroup.PassportPersonInfoCard.BirthDate));
            }

            var birthInfo = new BirthInfo(_firstCardGroup.PassportPersonInfoCard.BirthDate.Value,
                                          _firstCardGroup.PassportPersonInfoCard.BirthPlace);

            var personInfo = new PersonInfo(fullName, birthInfo);

            var registerLocation = new Address(_firstCardGroup.PassportAccommodationCard.RegisterLocation);
            var actuallyLocation = new Address(_firstCardGroup.PassportAccommodationCard.ActuallyLocation);
            var locality         = _firstCardGroup.PassportAccommodationCard.Locality;

            var locationInfo = new PassportLocationInfo(registerLocation, actuallyLocation, locality);

            var passportFamilyInfo = new PassportFamilyInfo(_firstCardGroup.PassportFamilyInfoCard.FamilyStatus.ToFamilyStatusEnum(),
                                                            _firstCardGroup.PassportFamilyInfoCard.IsHaveBaby);

            return(new PassportInfo(photoName, code, issueInfo, personInfo, locationInfo, passportFamilyInfo));
        }
Example #5
0
        private static PassportInfo BuildPassportInfo(int sqliteId, string photoExtension)
        {
            var photoName = $"{sqliteId}{photoExtension}";

            var code = new Code("5013", "055467");

            var issueInfo = new PassportIssueInfo("ОУФМС РФ по НСО в Ленинском районе", "540007",
                                                  new DateTime(2016, 1, 1));

            var fullName   = new FullName("Иванов" + sqliteId, "Иван" + sqliteId, "Иванович" + sqliteId);
            var birthInfo  = new BirthInfo(new DateTime(1999, 1, 1), "НСО, г. Новосибирск");
            var personInfo = new PersonInfo(fullName, birthInfo);

            var registerLocation = new Address("Новосибирская обл., г. Новосибирск, ул. Валдайская, д. 19/1");
            var actuallyLocation = new Address("Новосибирская обл., г. Новосибирск, ул. Валдайская, д. 19/1");
            var locality         = "г. Новосибирск";

            var locationInfo = new PassportLocationInfo(registerLocation, actuallyLocation, locality);

            var passportFamilyInfo = new PassportFamilyInfo(familyStatus: FamilyStatus.Single, isHaveBaby: false);

            return(new PassportInfo(photoName, code, issueInfo, personInfo, locationInfo, passportFamilyInfo));
        }