/// <summary> /// Reveals any hidden members using the provided expression and revealing convention. /// </summary> /// <param name="expression"> /// The expression. /// </param> /// <param name="convention"> /// The revealing convention. /// </param> /// <typeparam name="TEntity"> /// The <see cref="System.Type" /> of the entity. /// </typeparam> /// <returns> /// The hidden member name. /// </returns> public static string ByConvention <TEntity> ( Expression <Func <TEntity, object> > expression, IRevealConvention convention ) { IRevealer revealer = new Revealer(convention); return(revealer.Reveal(expression)); }
/// <summary> /// Reveals any hidden members using the provided expression. /// </summary> /// <param name="expression"> /// The expression. /// </param> /// <typeparam name="TEntity"> /// The <see cref="System.Type" /> of the entity. /// </typeparam> /// <returns> /// The hidden member name. /// </returns> public static string ByConvention <TEntity>(Expression <Func <TEntity, object> > expression) { if (DefaultConvention != null) { return(ByConvention(expression, DefaultConvention)); } IRevealer revealer = new Revealer(); return(revealer.Reveal(expression)); }
public void CanProvideConventionAtInstantiation() { IRevealer <UserEntity> revealer = new Revealer <UserEntity>(new UnderscoreConvention()); Assert.That(revealer.Reveal(x => x.Password), Is.EqualTo("_Password")); }