Esempio n. 1
0
        public void MapToInheritedInterface()
        {
            var dto = new InheritedDto
            {
                Id             = 1,
                Name           = "Test",
                DateOfBirth    = new DateTime(1978, 12, 10),
                UnmappedSource = "Lorem ipsum"
            };

            var config = new TypeAdapterConfig();

            IInheritedDto idto = dto.Adapt <IInheritedDto>(config);

            idto.ShouldNotBeNull();
            idto.ShouldSatisfyAllConditions(
                () => idto.Id.ShouldBe(dto.Id),
                () => idto.Name.ShouldBe(dto.Name),
                () => idto.DateOfBirth.ShouldBe(dto.DateOfBirth),
                () => idto.UnmappedTarget.ShouldBeNull()
                );
        }
Esempio n. 2
0
        public void MapToInstanceWithInterface()
        {
            var dto = new InheritedDto
            {
                Id             = 1,
                Name           = "Test",
                DateOfBirth    = new DateTime(1978, 12, 10),
                UnmappedSource = "Lorem ipsum"
            };

            var config = new TypeAdapterConfig();

            IInheritedDto target = new ImplementedDto();

            dto.Adapt(target, config);

            target.ShouldNotBeNull();
            target.ShouldSatisfyAllConditions(
                () => target.Id.ShouldBe(dto.Id),
                () => target.Name.ShouldBe(dto.Name),
                () => target.DateOfBirth.ShouldBe(dto.DateOfBirth),
                () => target.UnmappedTarget.ShouldBeNull()
                );
        }