Achieved 100% test coverage for the TransformingReadOnlyCollection and ReadOnlyList classes

git-svn-id: file:///srv/devel/repo-conversion/nusu@97 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2008-11-27 19:40:43 +00:00
parent 195ba1df30
commit 5c90646327
7 changed files with 886 additions and 94 deletions

View file

@ -181,15 +181,15 @@ namespace Nuclex.Support.Collections {
/// Array is null.
/// </exception>
public void CopyTo(ExposedItemType[] array, int index) {
if(this.items.Count > (array.Length - index))
if(this.items.Count > (array.Length - index)) {
throw new ArgumentException(
"Array too small to fit the collection items starting at the specified index"
);
}
for(int itemIndex = 0; itemIndex < this.items.Count; ++itemIndex)
for(int itemIndex = 0; itemIndex < this.items.Count; ++itemIndex) {
array[itemIndex + index] = Transform(this.items[itemIndex]);
}
}
/// <summary>
@ -266,6 +266,11 @@ namespace Nuclex.Support.Collections {
get { return Transform(this.items[index]); }
}
/// <summary>Whether the List is write-protected</summary>
public bool IsReadOnly {
get { return true; }
}
/// <summary>Transforms an item into the exposed type</summary>
/// <param name="item">Item to be transformed</param>
/// <returns>The transformed item</returns>