public static IfFilterExpression IfPropertyImplements( this ConventionExpression conventionExpression, Type typeImplemented) { return(conventionExpression.IfProperty(p => p.PropertyType.Implements(typeImplemented) || p.PropertyType.ImplementsGenericOf(typeImplemented))); }
public static IfFilterExpression IfPropertyIs <TType>( this ConventionExpression conventionExpression, Expression <Func <TType, object> > expression) where TType : class { return(conventionExpression.IfProperty(p => p.DeclaringType == typeof(TType) && p.Name == expression.ToAccessor().Name)); }
public static Fixture AddConvention(this Fixture fixture, Faker faker, Action <ConventionExpression> convention) { var conventionExpression = new ConventionExpression(faker); convention(conventionExpression); fixture.AddOrInsertMiruSpecimen(conventionExpression); return(fixture); }
private static void AddOrInsertMiruSpecimen(this Fixture fixture, ConventionExpression conventionExpression) { var existentSpecimenIndex = fixture.Customizations.FindIndex(x => x is MiruConventionSpecimenBuilder); var specimen = new MiruConventionSpecimenBuilder(conventionExpression); if (existentSpecimenIndex < 0) { fixture.Customizations.Add(specimen); } else { fixture.Customizations.Insert(existentSpecimenIndex, specimen); } }
public static IfFilterExpression IfPropertyNameIs( this ConventionExpression conventionExpression, string propertyName) { return(conventionExpression.IfProperty(p => p.Name == propertyName)); }
public static IfFilterExpression IfClassImplements <TType>(this ConventionExpression conventionExpression) { return(conventionExpression.IfClass(t => t.Implements <TType>())); }
public static IfFilterExpression IfClassIs <TType>(this ConventionExpression conventionExpression) { return(conventionExpression.IfClass(t => t == typeof(TType))); }
public static IfFilterExpression IfPropertyImplementsEnumerableOf <TType>( this ConventionExpression conventionExpression) { return(conventionExpression.IfProperty(p => p.PropertyType.ImplementsEnumerableOf <TType>())); }
public static IfFilterExpression IfPropertyTypeIs <TType>(this ConventionExpression conventionExpression) { return(conventionExpression.IfProperty(p => p.PropertyType == typeof(TType))); }
public static IfFilterExpression IfPropertyNameEnds( this ConventionExpression conventionExpression, string propertyNameEnd) { return(conventionExpression.IfProperty(p => p.Name.EndsWith(propertyNameEnd))); }
public MiruConventionSpecimenBuilder(ConventionExpression convention) { Convention = convention; }
public UseExpression(Func <object> use, ConventionExpression conventionExpression) { _use = use; _conventionExpression = conventionExpression; }