using System.Collections.Generic; using NUnit.Framework; namespace Chernobyl.Collections.Generic.Event { [TestFixture, Description("Tests for the DecoratingEventDictionary type.")] public class DecoratingEventDictionaryTests : EventDictionaryTests { public DecoratingEventDictionaryTests() : base(false) {} public class DictionaryTests : DictionaryTests { public DictionaryTests() : base(false) {} protected override IDictionary CreateDictionary() { return StaticCreateManyItemEventDictionary(); } protected override IDictionary CreateReadOnlyDictionary() { // Read-only DecoratingEventDictionary not supported. return null; } protected override KeyValuePair CreateItem() { return StaticCreateItem(); } } static IEventDictionary StaticCreateSingleItemEventDictionary() { IEventDictionary eventDictionary = new DecoratingEventDictionary(); eventDictionary.Add("1", "Value 1"); return eventDictionary; } static IEventDictionary StaticCreateManyItemEventDictionary() { IEventDictionary eventDictionary = new DecoratingEventDictionary(); for (int i = 0; i < RequiredCollectionCount; i++) { string indexStr = i.ToString(); eventDictionary.Add(indexStr, "Value " + indexStr); } return eventDictionary; } protected static KeyValuePair StaticCreateItem() { return new KeyValuePair("10", "Value 10"); } protected override IEventDictionary CreateSingleItemEventDictionary() { return StaticCreateSingleItemEventDictionary(); } protected override IEventDictionary CreateManyItemEventDictionary() { return StaticCreateManyItemEventDictionary(); } protected override KeyValuePair CreateItem() { return StaticCreateItem(); } } }