diff --git a/Source/Collections/Constants.cs b/Source/Collections/Constants.cs
index 202a3ff..6af5251 100644
--- a/Source/Collections/Constants.cs
+++ b/Source/Collections/Constants.cs
@@ -19,16 +19,20 @@ License along with this library
#endregion
using System;
+#if !NO_SPECIALIZED_COLLECTIONS
using System.Collections.Specialized;
+#endif
namespace Nuclex.Support.Collections {
/// Contains fixed constants used by some collections
public static class Constants {
+#if !NO_SPECIALIZED_COLLECTIONS
/// Fixed event args used to notify that the collection has reset
public static readonly NotifyCollectionChangedEventArgs NotifyCollectionResetEventArgs =
new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);
+#endif
}
diff --git a/Source/Collections/ObservableDictionary.Test.cs b/Source/Collections/ObservableDictionary.Test.cs
index 39c3d77..16c709c 100644
--- a/Source/Collections/ObservableDictionary.Test.cs
+++ b/Source/Collections/ObservableDictionary.Test.cs
@@ -60,6 +60,13 @@ namespace Nuclex.Support.Collections {
/// Contains the item that is being removed
void ItemRemoved(object sender, ItemEventArgs> arguments);
+ /// Called when an item is replaced in the dictionary
+ /// Dictionary in which an item is being replaced
+ /// Contains the replaced item and its replacement
+ void ItemReplaced(
+ object sender, ItemReplaceEventArgs> arguments
+ );
+
}
#endregion // interface IObservableDictionarySubscriber
@@ -89,6 +96,10 @@ namespace Nuclex.Support.Collections {
new EventHandler>>(
this.mockedSubscriber.MockObject.ItemRemoved
);
+ this.observedDictionary.ItemReplaced +=
+ new EventHandler>>(
+ this.mockedSubscriber.MockObject.ItemReplaced
+ );
}
///
@@ -288,11 +299,9 @@ namespace Nuclex.Support.Collections {
[Test]
public void TestReplaceByIndexerViaGenericIDictionary() {
this.mockedSubscriber.Expects.One.Method(
- m => m.ItemRemoved(null, null)
- ).WithAnyArguments();
- this.mockedSubscriber.Expects.One.Method(
- m => m.ItemAdded(null, null)
+ m => m.ItemReplaced(null, null)
).WithAnyArguments();
+
(this.observedDictionary as IDictionary)[42] = "two and fourty";
this.mockery.VerifyAllExpectationsHaveBeenMet();
diff --git a/Source/Collections/ObservableList.Test.cs b/Source/Collections/ObservableList.Test.cs
index 30fb4b5..f95bcd9 100644
--- a/Source/Collections/ObservableList.Test.cs
+++ b/Source/Collections/ObservableList.Test.cs
@@ -57,6 +57,11 @@ namespace Nuclex.Support.Collections {
/// Contains the item that is being removed
void ItemRemoved(object sender, ItemEventArgs arguments);
+ /// Called when an item is replaced in the dictionary
+ /// Dictionary in which an item is being replaced
+ /// Contains the replaced item and its replacement
+ void ItemReplaced(object sender, ItemReplaceEventArgs arguments);
+
}
#endregion // interface IObservableCollectionSubscriber
@@ -81,6 +86,9 @@ namespace Nuclex.Support.Collections {
this.observedList.ItemRemoved += new EventHandler>(
this.mockedSubscriber.MockObject.ItemRemoved
);
+ this.observedList.ItemReplaced += new EventHandler>(
+ this.mockedSubscriber.MockObject.ItemReplaced
+ );
}
/// Tests whether the Clearing event is fired
@@ -128,8 +136,7 @@ namespace Nuclex.Support.Collections {
this.observedList.Add(2);
this.observedList.Add(3);
- this.mockedSubscriber.Expects.One.Method(m => m.ItemRemoved(null, null)).WithAnyArguments();
- this.mockedSubscriber.Expects.One.Method(m => m.ItemAdded(null, null)).WithAnyArguments();
+ this.mockedSubscriber.Expects.One.Method(m => m.ItemReplaced(null, null)).WithAnyArguments();
// Replace the middle item with something else
this.observedList[1] = 4;