Exemple #1
0
        public void ForDtoWithNestedDtoAlwaysReturnCorrectKeys()
        {
            // arrange
            var dto     = TestModels.GetDtoWithNestedDto();
            var builder = new BitmapBuilder <DtoWithNestedDto>();

            // act
            builder.IndexFor(dto, simpleDto => simpleDto.Integer);
            builder.IndexFor(dto, simpleDto => simpleDto.Double);
            builder.IndexForClass(dto, simpleDto => simpleDto.NestedDto, nestedDto => nestedDto.Boolean);

            var builtKeys = builder.Keys();

            // assert
            builtKeys.Should().BeEquivalentTo(new List <string>
            {
                "Integer.123", "Double.-2,5", "NestedDto.Boolean.False"
            });
        }
Exemple #2
0
        public void ForPrimitiveDtoAlwaysReturnCorrectKeys()
        {
            // arrange
            var dto     = TestModels.GetSimpleDto();
            var builder = new BitmapBuilder <SimpleDto>();

            // act
            builder.IndexFor(dto, simpleDto => simpleDto.Integer);
            builder.IndexFor(dto, simpleDto => simpleDto.Str);
            builder.IndexFor(dto, simpleDto => simpleDto.Boolean);
            builder.IndexFor(dto, simpleDto => simpleDto.Float);

            var builtKeys = builder.Keys();

            // assert
            builtKeys.Should().BeEquivalentTo(new List <string>
            {
                "Integer.123", "Str.string", "Boolean.True", "Float.1,5"
            });
        }
Exemple #3
0
        public void IndexForWithCustomKeyReturnCorrectKeys()
        {
            // arrange
            var dto     = TestModels.GetSimpleDto();
            var builder = new BitmapBuilder <DtoWithNestedDto>();

            // act
            builder.IndexFor("testKey", simpleDto => simpleDto.NestedDto.Boolean);

            var builtKeys = builder.Keys();

            // assert
            builtKeys.Should().BeEquivalentTo("testKey");
        }