public void Validate_Map_List_Entity_To_Dto_Only_The_Third_Property()
        {
            var listOfEntity = new FixtureExtensions().GetListEntityWithValuesInThirdProperty();

            //Get the values from the property "Second" from the property "Third"
            var expectValues = listOfEntity.Select(x => x.GetType()
                                                         .GetProperty("Third")
                                                         .GetValue(x)
                                                         .GetType()
                                                         .GetProperty("Second")
                                                         .GetValue(x.GetType()
                                                                    .GetProperty("Third")
                                                                    .GetValue(x))
                                                                    );
            //Convert all de list of entities to list of dtos
            var listOfDtos = _tool.MapList<FixturePublic.Entity, FixtureExtensions.DTO>(listOfEntity);

            var values = listOfDtos.Select(x => x.GetType().GetProperty("ThirdWithSecond").GetValue(x));

            values.ShouldAllBeEquivalentTo(expectValues);
        }
        public void Validate_Map_List_Dto_To_Entity_Only_The_Fourth_Property()
        {
            var listOfEntity = new FixtureExtensions().GetListEntityWithValuesInFourthProperty();

            //Get the values from the property "First" from the property "Fourth" from the property "Third"
            var expectValues = listOfEntity.Select(x => x.GetType()
                                                         .GetProperty("Third")
                                                         .GetValue(x)
                                                         .GetType()
                                                         .GetProperty("Fourth")
                                                         .GetValue(x.GetType()
                                                                    .GetProperty("Third")
                                                                    .GetValue(x)
                                                                   )
                                                          .GetType()
                                                          .GetProperty("First")
                                                          .GetValue(x.GetType()
                                                                     .GetProperty("Third")
                                                                     .GetValue(x)
                                                                     .GetType()
                                                                     .GetProperty("Fourth")
                                                                     .GetValue(x.GetType()
                                                                                .GetProperty("Third")
                                                                                .GetValue(x))
                                                                     )
                                                    );
            //Convert all de list of entities to list of dtos
            var listOfDtos = _tool.MapList<FixturePublic.Entity, FixtureExtensions.DTO>(listOfEntity);
            var listOfNewEntities = _tool.ConvertListToEntity<FixtureExtensions.DTO, FixtureExtensions.Entity>(listOfDtos);

            //Get all values from the la property "ThirdWithFourthWithSecond"
            var values = listOfNewEntities.Select(x => x.GetType()
                                                         .GetProperty("Third")
                                                         .GetValue(x)
                                                         .GetType()
                                                         .GetProperty("Fourth")
                                                         .GetValue(x.GetType()
                                                                    .GetProperty("Third")
                                                                    .GetValue(x)
                                                                   )
                                                          .GetType()
                                                          .GetProperty("First")
                                                          .GetValue(x.GetType()
                                                                     .GetProperty("Third")
                                                                     .GetValue(x)
                                                                     .GetType()
                                                                     .GetProperty("Fourth")
                                                                     .GetValue(x.GetType()
                                                                                .GetProperty("Third")
                                                                                .GetValue(x))
                                                                     )
                                                    );

            values.ShouldAllBeEquivalentTo(expectValues);
        }
        public void Validate_Map_List_Entity_To_Dto_Only_The_Second_Property()
        {
            var listOfEntity = new FixtureExtensions().GetListOfEntityWithValuesInFirstAndSecondProperty();
            var expectValues = listOfEntity.Select(x => x.GetType().GetProperty("Second").GetValue(x));

            var listOfDtos = _tool.MapList<FixturePublic.Entity, FixtureExtensions.DTO>(listOfEntity);

            var values = listOfDtos.Select(x => x.GetType().GetProperty("SecondProperty").GetValue(x));

            values.ShouldAllBeEquivalentTo(expectValues);
        }
Ejemplo n.º 4
0
        public void Validate_Map_List_Dto_To_Entity_Only_The_Second_Property()
        {
            var listOfEntity = new FixtureExtensions().GetListOfEntityWithValuesInFirstAndSecondProperty();
            var expectValues = listOfEntity.Select(x => x.GetType().GetProperty("Second").GetValue(x));

            var listOfDtos = listOfEntity.ConvertListToDto<FixtureExtensions.DTO>();
            var listOfNewEntities = listOfDtos.ConvertListToEntity<FixtureExtensions.Entity>();

            var values = listOfNewEntities.Select(x => x.GetType().GetProperty("Second").GetValue(x));

            values.ShouldAllBeEquivalentTo(expectValues);
        }