Ejemplo n.º 1
0
        public void FamilyInfoTest()
        {
            var parentFamilyStatus = ParentFamilyStatus.Full;

            var motherRelativeStatus = RelativeStatus.Mother;
            var motherFullName       = new FullName("Евдокимова", "Евгения", "Вадимовна");
            var motherBirthInfo      = new BirthInfo(new DateTime(1980, 1, 1), "г. Барнаул");
            var motherPersonInfo     = new PersonInfo(motherFullName, motherBirthInfo);
            var motherWorkPlace      = "Магазин игрушек";

            var motherInfo = new RelativeInfo(motherRelativeStatus, motherPersonInfo, motherWorkPlace);

            var fatherRelativeStatus = RelativeStatus.Father;
            var fatherFullName       = new FullName("Евдокимов", "Евгений", "Сергеевич");
            var fatherBirthInfo      = new BirthInfo(new DateTime(1981, 1, 1), "г. Барнаул");
            var fatherPersonInfo     = new PersonInfo(fatherFullName, fatherBirthInfo);
            var fatherWorkPlace      = "Завод";

            var fatherInfo = new RelativeInfo(fatherRelativeStatus, fatherPersonInfo, fatherWorkPlace);

            var relatives = new List <RelativeInfo>()
            {
                motherInfo, fatherInfo
            };
            var familyInfo = new FamilyInfo(parentFamilyStatus, relatives);

            Assert.AreEqual(parentFamilyStatus, familyInfo.ParentFamilyStatus);
            Assert.AreEqual(motherInfo, familyInfo.GetRelative(0));
            Assert.AreEqual(fatherInfo, familyInfo.GetRelative(1));
        }
Ejemplo n.º 2
0
        private static void FillFamilyInfo(priz priz, FamilyInfo familyInfo)
        {
            priz.parents = familyInfo.ParentFamilyStatus.ToParentFamilyStatusString();

            // I didn't want write this code, but db structure force me do it

            int          curRelativeIdx  = 0;
            RelativeInfo currentRelative = null;

            currentRelative = familyInfo.GetRelative(curRelativeIdx++);
            if (currentRelative != null)
            {
                priz.relation             = currentRelative.RelativeStatus.ToRelativeStatusString();
                priz.relative_name        = currentRelative.PersonInfo.FullName.Value;
                priz.relative_birth_date  = currentRelative.PersonInfo.BirthInfo.Date.ToString(DateConstants.RecruitDateFormat);
                priz.relative_birth_place = currentRelative.PersonInfo.BirthInfo.Place;
                priz.relative_work_place  = currentRelative.WorkPlace;
            }

            currentRelative = familyInfo.GetRelative(curRelativeIdx++);
            if (currentRelative != null)
            {
                priz.relation2             = currentRelative.RelativeStatus.ToRelativeStatusString();
                priz.relative_name2        = currentRelative.PersonInfo.FullName.Value;
                priz.relative_birth_date2  = currentRelative.PersonInfo.BirthInfo.Date.ToString(DateConstants.RecruitDateFormat);
                priz.relative_birth_place2 = currentRelative.PersonInfo.BirthInfo.Place;
                priz.relative_work_place2  = currentRelative.WorkPlace;
            }

            currentRelative = familyInfo.GetRelative(curRelativeIdx++);
            if (currentRelative != null)
            {
                priz.relation3             = currentRelative.RelativeStatus.ToRelativeStatusString();
                priz.relative_name3        = currentRelative.PersonInfo.FullName.Value;
                priz.relative_birth_date3  = currentRelative.PersonInfo.BirthInfo.Date.ToString(DateConstants.RecruitDateFormat);
                priz.relative_birth_place3 = currentRelative.PersonInfo.BirthInfo.Place;
                priz.relative_work_place3  = currentRelative.WorkPlace;
            }
        }
Ejemplo n.º 3
0
        public void FamilyInfoGettingExceptionTest()
        {
            var parentFamilyStatus   = ParentFamilyStatus.Full;
            var motherRelativeStatus = RelativeStatus.Mother;
            var motherFullName       = new FullName("Евдокимова", "Евгения", "Вадимовна");
            var motherBirthInfo      = new BirthInfo(new DateTime(1980, 1, 1), "г. Барнаул");
            var motherPersonInfo     = new PersonInfo(motherFullName, motherBirthInfo);
            var motherWorkPlace      = "Магазин игрушек";

            var motherInfo = new RelativeInfo(motherRelativeStatus, motherPersonInfo, motherWorkPlace);

            var familyInfo = new FamilyInfo(parentFamilyStatus);

            familyInfo.AddRelative(motherInfo);

            Assert.IsNull(familyInfo.GetRelative(1));
        }