コード例 #1
0
        public void CanRevealWithAliasFromTypedExpressionUsingProvidedConvention()
        {
            UserEntity u = null;

            Assert
            .That
            (
                Reveal.ByConvention <UserEntity>(x => u.Password, new UnderscoreConvention()),
                Is.EqualTo("u._Password")
            );
        }
コード例 #2
0
        public void CanSetDefaultConventionToConventionDelegate()
        {
            Reveal.SetDefaultConvention(s => "L" + s);

            Assert.That(Reveal.ByConvention <UserEntity>(x => x.Password), Is.EqualTo("LPassword"));

            UserEntity u = null;

            Assert.That(Reveal.ByConvention(() => u.Password), Is.EqualTo("u.LPassword"));
            Assert.That(Reveal.ByConvention(() => u, x => x.Password), Is.EqualTo("u.LPassword"));

            IRevealer revealer = Reveal.CreateRevealer();

            Assert.That(revealer.Reveal <UserEntity>(x => x.Password), Is.EqualTo("LPassword"));

            IRevealer <UserEntity> revealerOfUser = Reveal.CreateRevealer <UserEntity>();

            Assert.That(revealerOfUser.Reveal(x => x.Password), Is.EqualTo("LPassword"));
        }
コード例 #3
0
        /// <inheritdoc />
        public virtual IFetchBuilder <TQuery> Fetch
        (
            Expression <Func <TSource, object> > expression,
            Expression <Func <object> > alias  = null,
            IRevealConvention revealConvention = null
        )
        {
            if (revealConvention == null)
            {
                revealConvention = Reveal.DefaultConvention ?? new CustomConvention(x => x);
            }

            string path = Reveal.ByConvention(expression, revealConvention);

            string aliasValue = alias != null
                ? ExpressionHelper.GetPropertyName(alias)
                : path;

            return(FetchCore(path, aliasValue));
        }
コード例 #4
0
        public void CanRevealWithAliasFromTypedExpression()
        {
            UserEntity u = null;

            Assert.That(Reveal.ByConvention <UserEntity>(x => u.Password), Is.EqualTo("u.m_Password"));
        }
コード例 #5
0
        public void CanRevealDeepWithAliasFromUntypedExpression()
        {
            UserEntity u = null;

            Assert.That(Reveal.ByConvention(() => u.Setting.Id), Is.EqualTo("u.Setting.m_Id"));
        }
コード例 #6
0
 public void CanRevealDeep()
 {
     Assert.That(Reveal.ByConvention <UserEntity>(x => x.Setting.Id), Is.EqualTo("Setting.m_Id"));
 }
コード例 #7
0
 public void UsesMUnderscoreConventionByDefault()
 {
     Assert.That(Reveal.ByConvention <UserEntity>(x => x.Password), Is.EqualTo("m_Password"));
 }
コード例 #8
0
        public void CanSetDefaultConvention()
        {
            Reveal.SetDefaultConvention(new CustomConvention(s => "ere" + s + "::-"));

            Assert.That(Reveal.ByConvention <UserEntity>(x => x.Username), Is.EqualTo("ereUsername::-"));
        }
コード例 #9
0
 public void CanRevealWithoutSpecifyingDefaultConvention()
 {
     Assert.That(() => Reveal.ByConvention <UserEntity>(x => x.Password), Throws.Nothing);
 }
コード例 #10
0
 public void CanRevealWithConventionSpecified()
 {
     Assert.That(Reveal.ByConvention <UserEntity>(x => x.Username, new MConvention()), Is.EqualTo("mUsername"));
 }