예제 #1
0
        public void OuterPropsShouldNotAbortMapping()
        {
            //arrange
            const string helloWorld = "Hello world";
            Mapper.CreateMap<SmallEntity, BigEntity>();
            var smallEntity = new SmallEntity {Name = helloWorld};

            //act
            var result = smallEntity.Map<SmallEntity, BigEntity>();

            //assert
            Assert.AreEqual(result.Name, helloWorld);
            Assert.AreEqual(result.ExternalEntity, null);
            Assert.AreEqual(result.IntField, 0);
        }
예제 #2
0
        public void Read_untyped_object()
        {
            using var repo = new LiteRepository(dbFile).WithUtcDate();

            var custom = new SmallEntity {
                Id = Id <SmallEntity> .NewId(), Field1 = "ffff"
            };

            repo.Insert(new BigEntity {
                Field1 = "111", Field2 = "222", Custom = custom
            });
            var e       = repo.Query <BigEntity>().First();
            var custom2 = e.Custom.Should().BeOfType <SmallEntity>().Subject;

            custom2.Id.Should().Be(custom.Id);
            custom2.Field1.Should().Be(custom.Field1);
        }