Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/EnumerableExtensions.cs')
-rw-r--r--mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/EnumerableExtensions.cs72
1 files changed, 0 insertions, 72 deletions
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/EnumerableExtensions.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/EnumerableExtensions.cs
deleted file mode 100644
index efb9c82994f..00000000000
--- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/EnumerableExtensions.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Microsoft.Internal.Collections
-{
- public static class EnumerableExtensions
- {
- public static int Count(this IEnumerable source)
- {
- int count = 0;
-
- foreach (object o in source)
- {
- count++;
- }
-
- return count;
- }
-
- public static IEnumerable<T> ToEnumerable<T>(this IEnumerable source)
- {
- foreach (object value in source)
- {
- yield return (T)value;
- }
- }
-
- public static List<object> ToList(this IEnumerable source)
- {
- var enumerable = source.ToEnumerable<object>();
-
- return System.Linq.Enumerable.ToList(enumerable);
- }
-
- public static T AssertSingle<T>(this IEnumerable<T> source)
- {
- return AssertSingle(source, t => true);
- }
-
- public static T AssertSingle<T>(this IEnumerable<T> source, string message)
- {
- return AssertSingle(source, t => true, message);
- }
-
- public static T AssertSingle<T>(this IEnumerable<T> source, Func<T, bool> predicate)
- {
- return AssertSingle(source, predicate, "Expecting a single item matching the predicate in the collection.");
- }
-
- public static T AssertSingle<T>(this IEnumerable<T> source, Func<T, bool> predicate, string message)
- {
- int count = 0;
- T ret = default(T);
- foreach (T t in source)
- {
- if (predicate(t))
- {
- count++;
- ret = t;
- }
- }
-
- Assert.AreEqual(1, count, message);
- return ret;
- }
- }
-}