Exemple #1
0
        public void OutputModeltoOutputDTO_ShouldMapOutputModeltoOutputDTO()
        {
            //Arrange
            OutputModel model = new OutputModel {
                source_id = "789", address_line_1 = "10 Dalton Hill", gender = "M"
            };
            OutputDTO dto = new OutputDTO();

            var services = new ServiceCollection();

            services.AddAutoMapper(typeof(AutoMapping));
            services.AddTransient <IMappers, Mappers>();

            IServiceProvider serviceProvider = services.BuildServiceProvider();
            IMappers         mappers         = serviceProvider.GetRequiredService <IMappers>();

            //Act
            dto = mappers.OutputModeltoOutputDTO(model);

            //Assert
            Assert.NotNull(dto);
            Assert.Equal(model.source_id, dto.source_id);
            Assert.Equal(model.address_line_1, dto.address_line_1);
            Assert.Equal(model.gender, dto.gender);
        }
Exemple #2
0
        /// <summary>
        /// Gets Json from Resources and Transforms it into the Output format
        /// </summary>
        /// <returns>string</returns>
        public string GetLearner()
        {
            LearnerDTO   learnerDTO   = JsonFactory.LoadJson();
            LearnerModel learnerModel = mappers.LearnerDTOtoLearnerModel(learnerDTO);
            OutputModel  outputModel  = mappers.LearnerModeltoOutputModel(learnerModel);
            OutputDTO    outputDTO    = mappers.OutputModeltoOutputDTO(outputModel);

            return(JsonFactory.JsonSerialize(outputDTO));
        }