예제 #1
0
        public void Can_get_aliased_entity()
        {
            var entity = new xts_entity {
                Id = Guid.NewGuid()
            };

            entity.Set(e => e.xts_int, 123);
            entity.Set(e => e.xts_money, 200m);
            entity["rel.xts_money"] = new AliasedValue(
                "xts_relatedentity",
                "xts_money",
                new Money(450m)
                );
            entity["rel.xts_column"] = new AliasedValue(
                "xts_relatedentity",
                "xts_column",
                "MY-ALIASED-TEXT"
                );

            var aliasedEntity = entity.GetAliasedEntity <xts_relatedentity>("rel");

            Assert.Equal(450m, aliasedEntity.Get(e => e.xts_money).Value);
            Assert.Equal("MY-ALIASED-TEXT", aliasedEntity.Get(e => e.xts_withcolumnattribute));
        }