public static void EachIsDistinct <T>(this IAssertionTool assertTool, Expression <Func <IEnumerable <T> > > collectionExp, string msg, params object[] fmt) { var set = new HashSet <T>(); Func <IAssertionTool, T, bool> isDistinct = (assert, t) => { if (set.Contains(t)) { return(false); } set.Add(t); return(true); }; assertTool.Each(collectionExp, (assert, t) => assert.IsTrue(() => isDistinct(assert, t)), msg, fmt); }