Exemple #1
0
        private MilitaryInfo BuildMilitaryInfo()
        {
            var personalNumber = new Code(_secondCardGroup.MilitaryDocumentCard.PersonalNumber);
            var billetNumber   = new Code(_secondCardGroup.MilitaryDocumentCard.MilitaryBilletCode);

            SecretAccess secretAccess = null;

            if (_secondCardGroup.MilitaryDocumentCard.IsHaveSecretAccess)
            {
                var accessForm = _secondCardGroup.MilitaryDocumentCard.AccessForm.ToAccessFormEnum();
                var number     = _secondCardGroup.MilitaryDocumentCard.SecretAccessNumber;

                if (!_secondCardGroup.MilitaryDocumentCard.SecretAccessIssueDate.HasValue)
                {
                    throw new NullReferenceException(nameof(_secondCardGroup.MilitaryDocumentCard.SecretAccessIssueDate));
                }

                secretAccess = new SecretAccess(accessForm, number,
                                                _secondCardGroup.MilitaryDocumentCard.SecretAccessIssueDate.Value);
            }

            var militaryBillet = new MilitaryBillet(billetNumber, secretAccess);

            var proficiencyCategory = _secondCardGroup.ProficiencyCard.ProficiencyCategory.ToProficiencyCategoryEnum();
            var officialStatus      = _secondCardGroup.ProficiencyCard.OfficialStatus.ToOfficialStatusEnum();
            var nervously           = _secondCardGroup.ProficiencyCard.NervouslyPsychologicalStability.ToNervouslyPsychologicalStatusEnum();
            var general             = _secondCardGroup.ProficiencyCard.GeneralPsychologicalStability.ToGeneralPsychologicalStatusEnum();
            var proficiencyCard     = new ProficiencyCardInfo(proficiencyCategory, officialStatus, nervously, general);

            var speciality = _secondCardGroup.DistributionCard.Speciality;
            var teamMode   = _secondCardGroup.DistributionCard.TeamMode;

            return(new MilitaryInfo(personalNumber, militaryBillet, proficiencyCard, speciality, teamMode));
        }
        public void SecretAccessTest()
        {
            var accessForm = AccessForm.First;
            var number     = "1488";
            var issueDate  = new DateTime(2017, 1, 1);

            var secretAccess = new SecretAccess(accessForm, number, issueDate);

            Assert.AreEqual(accessForm, secretAccess.AccessForm);
            Assert.AreEqual(number, secretAccess.SecretAccessNumber);
            Assert.AreEqual(issueDate, secretAccess.IssueDate);
        }
        public void MilitaryBilletHaveAccessTest()
        {
            var billetNumber = new Code("АН 2281488");

            var accessForm   = AccessForm.First;
            var number       = "1488";
            var issueDate    = new DateTime(2017, 1, 1);
            var secretAccess = new SecretAccess(accessForm, number, issueDate);

            var militaryBillet = new MilitaryBillet(billetNumber, secretAccess);

            Assert.AreEqual(billetNumber, militaryBillet.BilletNumber);

            Assert.IsTrue(militaryBillet.IsHaveSecretAccess);
            Assert.AreEqual(accessForm, militaryBillet.SecretAccess.AccessForm);
            Assert.AreEqual(number, militaryBillet.SecretAccess.SecretAccessNumber);
            Assert.AreEqual(issueDate, militaryBillet.SecretAccess.IssueDate);
        }
        private MilitaryInfo BuildMilitaryInfo()
        {
            var personalNumber      = new Code("ВС 052572");
            var billetNumber        = new Code("АН 2281488");
            var accessForm          = AccessForm.First;
            var number              = "1488";
            var issueDate           = new DateTime(2017, 1, 1);
            var secretAccess        = new SecretAccess(accessForm, number, issueDate);
            var militaryBillet      = new MilitaryBillet(billetNumber, secretAccess);
            var proficiencyCategory = ProficiencyCategory.Second;
            var officialStatus      = OfficialStatus.Driver;
            var nervously           = NervouslyPsychologicalStatus.Satisfactory;
            var general             = GeneralPsychologicalStatus.High;
            var proficiencyCard     = new ProficiencyCardInfo(proficiencyCategory, officialStatus, nervously, general);
            var speciality          = MilitaryInfo.NoSpeciality;
            var teamMode            = "К-220А";

            return(new MilitaryInfo(personalNumber, militaryBillet, proficiencyCard, speciality, teamMode));
        }
        private static SecretAccess BuildSecretAccess(priz priz)
        {
            SecretAccess secretAccess = null;

            var accessForm = priz.f_access.ToAccessFormEnum();

            if (accessForm != AccessForm.None)
            {
                DateTime?secretAccessIssueDate = priz.d_access.GetDateTime();
                if (!secretAccessIssueDate.HasValue)
                {
                    throw new ArgumentException(nameof(priz));
                }

                var secretAccessNumber = priz.n_access;
                var issueDate          = secretAccessIssueDate.Value;

                secretAccess = new SecretAccess(accessForm, secretAccessNumber, issueDate);
            }

            return(secretAccess);
        }
        public void MilitaryInfoTest()
        {
            var personalNumber = new Code("ВС 052572");
            var billetNumber   = new Code("АН 2281488");
            var accessForm     = AccessForm.First;
            var number         = "1488";
            var issueDate      = new DateTime(2017, 1, 1);
            var secretAccess   = new SecretAccess(accessForm, number, issueDate);
            var militaryBillet = new MilitaryBillet(billetNumber, secretAccess);

            var proficiencyCategory = ProficiencyCategory.Second;
            var officialStatus      = OfficialStatus.Driver;
            var nervously           = NervouslyPsychologicalStatus.Satisfactory;
            var general             = GeneralPsychologicalStatus.High;
            var proficiencyCard     = new ProficiencyCardInfo(proficiencyCategory, officialStatus, nervously, general);

            var speciality = MilitaryInfo.NoSpeciality;
            var teamMode   = "К-220А";

            var militaryInfo = new MilitaryInfo(personalNumber, militaryBillet, proficiencyCard, speciality, teamMode);

            Assert.AreEqual(personalNumber, militaryInfo.PersonalNumber);

            Assert.AreEqual(billetNumber, militaryInfo.Billet.BilletNumber);
            Assert.IsTrue(militaryInfo.Billet.IsHaveSecretAccess);
            Assert.AreEqual(accessForm, militaryInfo.Billet.SecretAccess.AccessForm);
            Assert.AreEqual(number, militaryInfo.Billet.SecretAccess.SecretAccessNumber);
            Assert.AreEqual(issueDate, militaryInfo.Billet.SecretAccess.IssueDate);

            Assert.AreEqual(proficiencyCategory, militaryInfo.ProficiencyCard.ProficiencyCategory);
            Assert.AreEqual(officialStatus, militaryInfo.ProficiencyCard.OfficialStatus);
            Assert.AreEqual(general, militaryInfo.ProficiencyCard.GeneralPsychologicalStability);
            Assert.AreEqual(nervously, militaryInfo.ProficiencyCard.NervouslyPsychologicalStability);

            Assert.AreEqual(speciality, militaryInfo.Speciality);
            Assert.AreEqual(teamMode, militaryInfo.TeamMode);
        }