Beispiel #1
0
 public static AnswerModel ToAnswerModel(this AnswerInfoViewModel @this)
 {
     return(new AnswerModel
     {
         FirstName = @this.FirstName,
         LastName = @this.LastName,
         RegionId = @this.RegionCode,
         GenderId = @this.GenderCode,
         SchoolingId = @this.SchoolingCode,
         EthnicityId = @this.EthnicityCode
     });
 }
Beispiel #2
0
        public void FromAnswerInfoViewModel_ToAnswerModel()
        {
            // arrange
            var from = new AnswerInfoViewModel
            {
                EthnicityCode = 1,
                FirstName     = "First Name",
                GenderCode    = 2,
                LastName      = "Last Name",
                RegionCode    = 4,
                SchoolingCode = 5
            };

            // act
            var result = from.ToAnswerModel();

            // assert
            Assert.Equal(from.EthnicityCode, result.EthnicityId);
            Assert.Equal(from.FirstName, result.FirstName);
            Assert.Equal(from.GenderCode, result.GenderId);
            Assert.Equal(from.LastName, result.LastName);
            Assert.Equal(from.RegionCode, result.RegionId);
            Assert.Equal(from.SchoolingCode, result.SchoolingId);
        }