public static IListBuilder <Object> WithDefaults( this IListBuilder <Object> objectBuilder, bool hasTuin = false) { if (objectBuilder == null) { throw new ArgumentNullException(nameof(objectBuilder)); } return(objectBuilder .All() .And(x => x.MakelaarId = hasTuin ? MakelaarsTestDefaults.MakelaarIdWithTuin : MakelaarsTestDefaults.MakelaarId) .And(x => x.Woonplaats = MakelaarsTestDefaults.Woonplaats) .And(x => x.MakelaarNaam = hasTuin ? MakelaarsTestDefaults.MakelaarNaamWithTuin : MakelaarsTestDefaults.MakelaarNaam)); }
public static IListBuilder <TopMakelaar> WithDefaults( this IListBuilder <TopMakelaar> topMakelaarBuilder, bool hasTuin = false) { if (topMakelaarBuilder == null) { throw new ArgumentNullException(nameof(topMakelaarBuilder)); } return(topMakelaarBuilder .All() .And(x => x.MakelaarId = hasTuin ? MakelaarsTestDefaults.MakelaarIdWithTuin : MakelaarsTestDefaults.MakelaarId) .And(x => x.Count = MakelaarsTestDefaults.Count) .And(x => x.MakelaarName = hasTuin ? MakelaarsTestDefaults.MakelaarNaamWithTuin : MakelaarsTestDefaults.MakelaarNaam)); }
public static IListBuilder <T> WithValidData <T>(this IListBuilder <T> value) { return(value.All().With(ValidData)); }
public static List <T> BuildListOfNew <T>(this IListBuilder <T> builder) where T : ModelBase, new() { return(BuildList <T>(builder.All().With(c => c.Id = 0))); }
/// <summary> /// Builds a list of entities given an NBuilder list expression of data builders. /// </summary> /// <typeparam name="TBuilder">The type of the builder being built using NBuilder</typeparam> /// <typeparam name="TObject">The type of object being generated</typeparam> /// <param name="builderList">The NBuilder list of builders</param> /// <returns>The built list of objects</returns> public static IList <TObject> BuildList <TObject, TBuilder>(this IListBuilder <TBuilder> builderList) where TBuilder : ITestDataBuilder <TObject> where TObject : class { return(builderList.All().BuildList <TObject, TBuilder>()); }