Пример #1
0
        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 = listOfEntity.ConvertListToDto<FixtureExtensions.DTO>();

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

            values.ShouldAllBeEquivalentTo(expectValues);
        }
Пример #2
0
        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 = listOfEntity.ConvertListToDto<FixtureExtensions.DTO>();

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

            values.ShouldAllBeEquivalentTo(expectValues);
        }
Пример #3
0
        public void Validate_List_Of_Entity_With_Values_Enums()
        {
            var data = new FixtureExtensions().GetListSubEntityWithValues();
            var dto = data.ConvertListToDto<FixturePublic.Public4DTO>();
            var actual = dto.ConvertListToEntity<FixturePublic.SubEntity>();

            var values = actual.Select(y => y.GetType().GetProperties().Select(x => x.GetValue(actual)));
            values.Should().NotContainNulls();
        }
Пример #4
0
        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 = listOfEntity.ConvertListToDto<FixtureExtensions.DTO>();
            var listOfNewEntities = listOfDtos.ConvertListToEntity<FixtureExtensions.Entity>();

            //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);
        }
Пример #5
0
        public void Validate_List_Entity_When_The_Properties_Are_Equals()
        {
            var data = new FixtureExtensions().GetListOfEntityWithValues();
            var dto = data.ConvertListToDto<FixturePublic.Public2DTO>();
            var actual = dto.ConvertListToEntity<FixturePublic.Entity>();

            var values = actual.Select(y => y.GetType().GetProperties().Select(x => x.GetValue(actual)));
            values.Should().NotContainNulls();
        }