Index: Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj
===================================================================
diff -u -r00c8bc7fed580b4a9820a7d85b3b6d2346599f65 -r2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8
--- Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj (.../Core.Common.Utils.csproj) (revision 00c8bc7fed580b4a9820a7d85b3b6d2346599f65)
+++ Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj (.../Core.Common.Utils.csproj) (revision 2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8)
@@ -105,7 +105,6 @@
- TrueTrue
Index: Core/Common/src/Core.Common.Utils/Extensions/CollectionExtensions.cs
===================================================================
diff -u -rfa33f7c078c5d17f92f6a519f147a0a371593944 -r2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8
--- Core/Common/src/Core.Common.Utils/Extensions/CollectionExtensions.cs (.../CollectionExtensions.cs) (revision fa33f7c078c5d17f92f6a519f147a0a371593944)
+++ Core/Common/src/Core.Common.Utils/Extensions/CollectionExtensions.cs (.../CollectionExtensions.cs) (revision 2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8)
@@ -4,12 +4,21 @@
namespace Core.Common.Utils.Extensions
{
+ ///
+ /// Class defining extension methods for collections.
+ ///
public static class CollectionExtensions
{
+ ///
+ /// Remove all elements from a collection where a given check returns true.
+ ///
+ /// The type of the elements in the collection.
+ /// The collection from which elements should be removed.
+ /// The filtering method, that should return true if the
+ /// given element should be removed from .
public static void RemoveAllWhere(this ICollection source, Func condition)
{
- var list = source.Where(condition).ToList();
- foreach (T item in list)
+ foreach (T item in source.Where(condition).ToArray())
{
source.Remove(item);
}
Index: Core/Common/src/Core.Common.Utils/Extensions/ComparableExtensions.cs
===================================================================
diff -u -rfa33f7c078c5d17f92f6a519f147a0a371593944 -r2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8
--- Core/Common/src/Core.Common.Utils/Extensions/ComparableExtensions.cs (.../ComparableExtensions.cs) (revision fa33f7c078c5d17f92f6a519f147a0a371593944)
+++ Core/Common/src/Core.Common.Utils/Extensions/ComparableExtensions.cs (.../ComparableExtensions.cs) (revision 2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8)
@@ -2,18 +2,43 @@
namespace Core.Common.Utils.Extensions
{
+ ///
+ /// Class defines extension methods for objects.
+ ///
public static class ComparableExtensions
{
+ ///
+ /// Determines whether one object is greater then another.
+ ///
+ /// The first object.
+ /// The second object.
+ /// True if is considered greater then ,
+ /// false otherwise.
+ /// Object type of
+ /// is not the same as that of .
public static bool IsBigger(this IComparable object1, IComparable object2)
{
if (object1 == null)
{
- return false; // null is not bigger than anything
+ return false; // Null not bigger then anything (or equal to null).
}
+ if (object2 == null)
+ {
+ return true; // Anything is greater then null.
+ }
return object1.CompareTo(object2) > 0;
}
+ ///
+ /// Determines whether one object is smaller then another.
+ ///
+ /// The first object.
+ /// The second object.
+ /// True if is considered smaller then ,
+ /// false otherwise.
+ /// Object type of
+ /// is not the same as that of .
public static bool IsSmaller(this IComparable object1, IComparable object2)
{
if (object1 == null)
@@ -24,6 +49,15 @@
return object1.CompareTo(object2) < 0;
}
+ ///
+ /// Determines where one object is within the inclusive bounds of some range.
+ ///
+ /// Value to be checked.
+ /// First range value.
+ /// Second range value.
+ /// True if falls within the inclusive bounds, false otherwise.
+ /// Object type of
+ /// is not the same as that of or .
public static bool IsInRange(this IComparable value, IComparable limitOne, IComparable limitTwo)
{
IComparable min;
Index: Core/Common/src/Core.Common.Utils/Extensions/EnumerableExtensions.cs
===================================================================
diff -u -rfa33f7c078c5d17f92f6a519f147a0a371593944 -r2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8
--- Core/Common/src/Core.Common.Utils/Extensions/EnumerableExtensions.cs (.../EnumerableExtensions.cs) (revision fa33f7c078c5d17f92f6a519f147a0a371593944)
+++ Core/Common/src/Core.Common.Utils/Extensions/EnumerableExtensions.cs (.../EnumerableExtensions.cs) (revision 2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8)
@@ -5,8 +5,18 @@
namespace Core.Common.Utils.Extensions
{
+ ///
+ /// This class defines extension methods for and .
+ ///
public static class EnumerableExtensions
{
+ ///
+ /// Perform a certain action for each element in a sequence.
+ ///
+ /// The element type of the sequence.
+ /// A sequence that contains elements to be acted upon.
+ /// The action that should be performed on each element.
+ /// Do not define an action that effect .
public static void ForEachElementDo(this IEnumerable source, Action action)
{
foreach (var item in source)
Fisheye: Tag 2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Utils/Extensions/StringExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj
===================================================================
diff -u -rd53a27a49d8db860ff0894554dab040a1b6204a5 -r2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8
--- Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj (.../Core.Common.Utils.Test.csproj) (revision d53a27a49d8db860ff0894554dab040a1b6204a5)
+++ Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj (.../Core.Common.Utils.Test.csproj) (revision 2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8)
@@ -97,9 +97,9 @@
+
-
Index: Core/Common/test/Core.Common.Utils.Test/Extensions/CollectionExtensionsTest.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.Utils.Test/Extensions/CollectionExtensionsTest.cs (revision 0)
+++ Core/Common/test/Core.Common.Utils.Test/Extensions/CollectionExtensionsTest.cs (revision 2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8)
@@ -0,0 +1,78 @@
+using System.Collections.Generic;
+
+using Core.Common.Utils.Extensions;
+
+using NUnit.Framework;
+
+namespace Core.Common.Utils.Test.Extensions
+{
+ [TestFixture]
+ public class CollectionExtensionsTest
+ {
+ [Test]
+ public void RemoveAllWhere_FilterReturningTrueForAllElements_CollectionIsCleared()
+ {
+ // Setup
+ var collection = new List