public void Init() { var locManager = new Mock<ILocalizationManager>(); locManager.Setup( s => s.GetValidatorTranslationTEST(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())) .Returns("Some test string"); this.validator = new OLEPersonalDataBlockValidator(locManager.Object); // Init test Model this.model = ClassPropertyInitializator.SetProperties<OLEPersonalDataBlock>(new OLEPersonalDataBlock()); this.model.Birthday = DateTime.Now; this.model.Gender = Gender.Male; this.model.PersonCode = "1234"; this.model.CommunicationLanguage = CommunicationLanguage.Finnish; this.model.PersonName = ClassPropertyInitializator.SetProperties<PersonName>(new PersonName()); this.model.CurrentCitizenships = new System.Collections.Generic.List<OLECurrentCitizenship>(); for (int i = 0; i < 3; i++) { this.model.CurrentCitizenships.Add(new OLECurrentCitizenship { CurrentCitizenship = RandomData.GetString() }); } }
/// <summary> /// Maps from web to db Model /// </summary> /// <param name="input">OLEPersonalDataBlock Web model</param> /// <param name="dbModel">OLEPersonalInformationPage object model</param> public static void ToOLEPersonalDbModel(OLEPersonalDataBlock input, db.OLEPersonalInformationPage dbModel) { if (input == null || dbModel == null) { throw new ArgumentException("One of model is null"); } dbModel.PersonalBirthCountry = input.BirthCountry; dbModel.PersonalBirthday = input.Birthday; dbModel.PersonalBirthPlace = input.BirthPlace; dbModel.PersonalCommunicationLanguage = input.CommunicationLanguage.ToDbModel(); dbModel.PersonalEducation = input.Education; dbModel.PersonalGender = input.Gender.ToDbModel(); dbModel.PersonalMotherLanguage = input.MotherLanguage; dbModel.PersonalOccupation = input.Occupation; dbModel.PersonalPersonCode = input.PersonCode; dbModel.PersonalPersonNameFirstName = input.PersonName.FirstName; dbModel.PersonalPersonNameLastName = input.PersonName.LastName; input.CurrentCitizenships.ToCitizDbModel(OLECitizenshipRefTypeEnum.OLEPersonalInformationPersonalCurrent, dbModel.OleCitizenShipList); input.PreviousCitizenships.ToCitizDbModel(OLECitizenshipRefTypeEnum.OLEPersonalInformationPersonalPrevious, dbModel.OleCitizenShipList); input.PreviousNames.ToDbModel(db.TableRefEnums.PersonNameRefTypeEnum.OLEPersonalInformationPersonal, dbModel.OlePersonNameList); }