コード例 #1
0
ファイル: AssertEx.cs プロジェクト: Acidburn0zzz/PclUnit
 /// <summary>
 /// Verifies that the given collection contains only a single
 /// element of the given type.
 /// </summary>
 /// <typeparam name="T">The collection type.</typeparam>
 /// <param name="collection">The collection.</param>
 /// <returns>The single item in the collection.</returns>
 /// <exception cref="SingleException">Thrown when the collection does not contain
 /// exactly one element.</exception>
 public static T Single <T>(this IAssert assert, IEnumerable <T> collection)
 {
     return(assert.Single(collection, item => true));
 }