public virtual CopyValuesFromAsserter <T> AssertIEnumerableWith <TProp>(Expression <Func <T, IEnumerable <TProp> > > prop, CopyValuesFromAsserter <TProp> asserter) where TProp : class { string name = GetPropertyName(prop); properties[name].ShouldCopy = true; properties[name].IsEnumerable = true; properties[name].Asserter = (original, copy) => { var oList = (original as IEnumerable <TProp>); var cList = (copy as IEnumerable <TProp>); cList.Count().ShouldBe(oList.Count()); var zipped = oList.Zip(cList, (o, c) => new { o, c }); foreach (var item in zipped) { asserter.Assert(item.o, item.c); } }; return(this); }
public virtual CopyValuesFromAsserter <T> AssertWith <TProp>(Expression <Func <T, TProp> > prop, CopyValuesFromAsserter <TProp> asserter) where TProp : class { string name = GetPropertyName(prop); properties[name].ShouldCopy = true; properties[name].Asserter = (original, copy) => asserter.Assert((TProp)original, (TProp)copy); return(this); }