Example #1
0
        public void UpdateClassToObj_Test()
        {
            var src = new PartialCopyInterfInfo()
            {
                A = 1, Other = "other"
            };
            var dst = new PartialCopyObjInfo();

            new DtoCopier().Copy(dst, src, typeof(ICopyInfo), false, new HashSet <string>(new[] { nameof(src.A) }));

            dst.A.Should().Be(1);
            dst.Other.Should().BeNull();
        }
Example #2
0
        public void UpdateObjToClass_WithExclude_Test()
        {
            var src = new PartialCopyObjInfo()
            {
                A = 1, Other = "other"
            };
            var dst = new PartialCopyInterfInfo();

            new DtoCopier().Copy(dst, src, typeof(ICopyInfo), true, new HashSet <string>(new[] { nameof(src.B) }));

            dst.A.Should().Be(1);
            dst.B.Should().Be(0);
            dst.Other.Should().BeNull();
        }