From a39e3d49a7e67e2ad358b8490bcb7c75bf1c750c Mon Sep 17 00:00:00 2001 From: ik Date: Thu, 24 Apr 2014 19:14:15 -0700 Subject: [PATCH 1/2] Dictionary implements IDictionary and IDictionary --HG-- extra : source : 666e9778ab47cc7414d8f7ec00edb73be113beb6 --- Libraries/JSIL.Bootstrap.js | 134 +++++++++++++++++++++++++++++------- 1 file changed, 111 insertions(+), 23 deletions(-) diff --git a/Libraries/JSIL.Bootstrap.js b/Libraries/JSIL.Bootstrap.js index 4bfecf3a1..547d2fad4 100644 --- a/Libraries/JSIL.Bootstrap.js +++ b/Libraries/JSIL.Bootstrap.js @@ -2235,31 +2235,59 @@ JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2", function ($) throw new System.Exception("Key not found"); } ); + + var getKeysImpl = function GetKeys() { + if (this.tKeyCollection === null) { + this.tKeyCollection = $jsilcore.System.Collections.Generic.Dictionary$b2_KeyCollection.Of(this.TKey, this.TValue).__Type__; + this.tKeyEnumerator = $jsilcore.System.Collections.Generic.Dictionary$b2_KeyCollection_Enumerator.Of(this.TKey, this.TValue).__Type__; + } + return JSIL.CreateInstanceOfType(this.tKeyCollection, [this]); + }; + $.Method({Static:false, Public:true }, "get_Keys", (new JSIL.MethodSignature(mscorlib.TypeRef("System.Collections.Generic.Dictionary`2+KeyCollection", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.Dictionary`2"), new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2")]), [], [])), - function get_Keys () { - if (this.tKeyCollection === null) { - this.tKeyCollection = $jsilcore.System.Collections.Generic.Dictionary$b2_KeyCollection.Of(this.TKey, this.TValue).__Type__; - this.tKeyEnumerator = $jsilcore.System.Collections.Generic.Dictionary$b2_KeyCollection_Enumerator.Of(this.TKey, this.TValue).__Type__; - } - - return JSIL.CreateInstanceOfType(this.tKeyCollection, [this]); - } + getKeysImpl ); - - $.Method({Static:false, Public:true }, "get_Values", - (new JSIL.MethodSignature(mscorlib.TypeRef("System.Collections.Generic.Dictionary`2+ValueCollection", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.Dictionary`2"), new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2")]), [], [])), - function get_Values () { - if (this.tValueCollection === null) { - this.tValueCollection = $jsilcore.System.Collections.Generic.Dictionary$b2_ValueCollection.Of(this.TKey, this.TValue).__Type__; - this.tValueEnumerator = $jsilcore.System.Collections.Generic.Dictionary$b2_ValueCollection_Enumerator.Of(this.TKey, this.TValue).__Type__; + + $.Method({ Static: false, Public: true }, "get_Keys", + (new JSIL.MethodSignature(mscorlib.TypeRef("System.Collections.ICollection", []), [], [])), + getKeysImpl + ) + .Overrides("System.Collections.IDictionary", "get_Keys"); + + $.Method({ Static: false, Public: true }, "get_Keys", + (new JSIL.MethodSignature(mscorlib.TypeRef("System.Collections.Generic.ICollection`1", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.Dictionary`2")]), [], [])), + getKeysImpl + ) + .Overrides("System.Collections.Generic.IDictionary`2", "get_Keys"); + + var getValuesImpl = function GetValues() { + if (this.tValueCollection === null) { + this.tValueCollection = $jsilcore.System.Collections.Generic.Dictionary$b2_ValueCollection.Of(this.TKey, this.TValue).__Type__; + this.tValueEnumerator = $jsilcore.System.Collections.Generic.Dictionary$b2_ValueCollection_Enumerator.Of(this.TKey, this.TValue).__Type__; } - return JSIL.CreateInstanceOfType(this.tValueCollection, [this]); - } + return JSIL.CreateInstanceOfType(this.tValueCollection, [this]); + }; + + $.Method({ Static: false, Public: true }, "get_Values", + (new JSIL.MethodSignature(mscorlib.TypeRef("System.Collections.Generic.Dictionary`2+ValueCollection", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.Dictionary`2"), new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2")]), [], [])), + getValuesImpl ); - + + $.Method({ Static: false, Public: true }, "get_Values", + (new JSIL.MethodSignature(mscorlib.TypeRef("System.Collections.ICollection", []), [], [])), + getValuesImpl + ) + .Overrides("System.Collections.IDictionary", "get_Values"); + + $.Method({ Static: false, Public: true }, "get_Values", + (new JSIL.MethodSignature(mscorlib.TypeRef("System.Collections.Generic.ICollection`1", [new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2")]), [], [])), + getValuesImpl + ) + .Overrides("System.Collections.Generic.IDictionary`2", "get_Values"); + var getEnumeratorImpl = function GetEnumerator () { if (this.tEnumerator === null) { this.tEnumerator = $jsilcore.System.Collections.Generic.Dictionary$b2_Enumerator.Of(this.TKey, this.TValue).__Type__; @@ -2386,14 +2414,22 @@ JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+KeyCollection", return JSIL.CreateInstanceOfType(this.dictionary.tKeyEnumerator, [this.dictionary]); } ); - + + $.Method({ Static: false, Public: true }, "GetEnumerator", + new JSIL.MethodSignature($jsilcore.TypeRef("System.Collections.Generic.IEnumerator`1", [new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2+ValueCollection")]), [], []), + function GetEnumerator() { + return JSIL.CreateInstanceOfType(this.dictionary.tKeyEnumerator, [this.dictionary]); + } + ) + .Overrides("System.Collections.Generic.IEnumerable`1", "GetEnumerator"); + $.Method({Static:false, Public:false, Virtual:true }, "System.Collections.IEnumerable.GetEnumerator", new JSIL.MethodSignature($jsilcore.TypeRef("System.Collections.IEnumerator"), [], []), function System_Collections_IEnumerable_GetEnumerator () { return JSIL.CreateInstanceOfType(this.dictionary.tKeyEnumerator, [this.dictionary]); } ) - .Overrides(3, "GetEnumerator"); + .Overrides("System.Collections.IEnumerable", "GetEnumerator"); }); JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+ValueCollection", function ($interfaceBuilder) { @@ -2419,14 +2455,22 @@ JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+ValueCollection return JSIL.CreateInstanceOfType(this.dictionary.tValueEnumerator, [this.dictionary]); } ); - + + $.Method({ Static: false, Public: true }, "GetEnumerator", + new JSIL.MethodSignature($jsilcore.TypeRef("System.Collections.Generic.IEnumerator`1", [new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2+ValueCollection")]), [], []), + function GetEnumerator() { + return JSIL.CreateInstanceOfType(this.dictionary.tValueEnumerator, [this.dictionary]); + } + ) + .Overrides("System.Collections.Generic.IEnumerable`1", "GetEnumerator"); + $.Method({Static:false, Public:false, Virtual:true }, "System.Collections.IEnumerable.GetEnumerator", new JSIL.MethodSignature($jsilcore.TypeRef("System.Collections.IEnumerator"), [], []), function System_Collections_IEnumerable_GetEnumerator () { return JSIL.CreateInstanceOfType(this.dictionary.tValueEnumerator, [this.dictionary]); } ) - .Overrides(3, "GetEnumerator"); + .Overrides("System.Collections.IEnumerable", "GetEnumerator"); }); JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+KeyCollection+Enumerator", function ($interfaceBuilder) { @@ -2561,6 +2605,46 @@ JSIL.MakeStruct("System.ValueType", "System.Collections.Generic.KeyValuePair`2", $.Property({Static:false, Public:true }, "Value"); }); +JSIL.MakeInterface( + "System.Collections.Generic.IDictionary`2", true, ["TKey", "TValue"], function ($) { + $.Method({}, "get_Item", new JSIL.MethodSignature(new JSIL.GenericParameter("TValue", "System.Collections.Generic.IDictionary`2"), [new JSIL.GenericParameter("TKey", "System.Collections.Generic.IDictionary`2")], [])); + $.Method({}, "set_Item", new JSIL.MethodSignature(null, [new JSIL.GenericParameter("TKey", "System.Collections.Generic.IDictionary`2"), new JSIL.GenericParameter("TValue", "System.Collections.Generic.IDictionary`2")], [])); + $.Method({}, "get_Keys", new JSIL.MethodSignature($jsilcore.TypeRef("System.Collections.Generic.ICollection`1", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.IDictionary`2")]), [], [])); + $.Method({}, "get_Values", new JSIL.MethodSignature($jsilcore.TypeRef("System.Collections.Generic.ICollection`1", [new JSIL.GenericParameter("TValue", "System.Collections.Generic.IDictionary`2")]), [], [])); + $.Method({}, "ContainsKey", new JSIL.MethodSignature($.Boolean, [new JSIL.GenericParameter("TKey", "System.Collections.Generic.IDictionary`2")], [])); + $.Method({}, "Add", new JSIL.MethodSignature(null, [new JSIL.GenericParameter("TKey", "System.Collections.Generic.IDictionary`2"), new JSIL.GenericParameter("TValue", "System.Collections.Generic.IDictionary`2")], [])); + $.Method({}, "Remove", new JSIL.MethodSignature($.Boolean, [new JSIL.GenericParameter("TKey", "System.Collections.Generic.IDictionary`2")], [])); + $.Method({}, "TryGetValue", new JSIL.MethodSignature($.Boolean, [new JSIL.GenericParameter("TKey", "System.Collections.Generic.IDictionary`2"), $jsilcore.TypeRef("JSIL.Reference", [new JSIL.GenericParameter("TValue", "System.Collections.Generic.IDictionary`2")])], [])); + $.Property({}, "Item"); + $.Property({}, "Keys"); + $.Property({}, "Values"); + }, [ + $jsilcore.TypeRef("System.Collections.Generic.ICollection`1", [$jsilcore.TypeRef("System.Collections.Generic.KeyValuePair`2", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.IDictionary`2"), new JSIL.GenericParameter("TValue", "System.Collections.Generic.IDictionary`2")])]), + $jsilcore.TypeRef("System.Collections.Generic.IEnumerable`1", [$jsilcore.TypeRef("System.Collections.Generic.KeyValuePair`2", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.IDictionary`2"), new JSIL.GenericParameter("TValue", "System.Collections.Generic.IDictionary`2")])]), + $jsilcore.TypeRef("System.Collections.IEnumerable")]); + +JSIL.MakeInterface( +"System.Collections.IDictionary", true, [], function ($) { + $.Method({}, "get_Item", new JSIL.MethodSignature($.Object, [$.Object], [])); + $.Method({}, "set_Item", new JSIL.MethodSignature(null, [$.Object, $.Object], [])); + $.Method({}, "get_Keys", new JSIL.MethodSignature($jsilcore.TypeRef("System.Collections.ICollection"), [], [])); + $.Method({}, "get_Values", new JSIL.MethodSignature($jsilcore.TypeRef("System.Collections.ICollection"), [], [])); + $.Method({}, "Contains", new JSIL.MethodSignature($.Boolean, [$.Object], [])); + $.Method({}, "Add", new JSIL.MethodSignature(null, [$.Object, $.Object], [])); + $.Method({}, "Clear", new JSIL.MethodSignature(null, [], [])); + $.Method({}, "get_IsReadOnly", new JSIL.MethodSignature($.Boolean, [], [])); + $.Method({}, "get_IsFixedSize", new JSIL.MethodSignature($.Boolean, [], [])); + $.Method({}, "GetEnumerator", new JSIL.MethodSignature($jsilcore.TypeRef("System.Collections.IDictionaryEnumerator"), [], [])); + $.Method({}, "Remove", new JSIL.MethodSignature(null, [$.Object], [])); + $.Property({}, "Item"); + $.Property({}, "Keys"); + $.Property({}, "Values"); + $.Property({}, "IsReadOnly"); + $.Property({}, "IsFixedSize"); +}, [ +$jsilcore.TypeRef("System.Collections.ICollection"), +$jsilcore.TypeRef("System.Collections.IEnumerable")]); + JSIL.MakeClass("System.Object", "System.Collections.Generic.Dictionary`2", true, ["TKey", "TValue"], function ($) { $.Property({Public: true , Static: false}, "Count"); $.Property({Public: true , Static: false}, "Keys"); @@ -2568,7 +2652,11 @@ JSIL.MakeClass("System.Object", "System.Collections.Generic.Dictionary`2", true, $.ImplementInterfaces( $jsilcore.TypeRef("System.Collections.Generic.IEnumerable`1", [$jsilcore.TypeRef("System.Collections.Generic.KeyValuePair`2", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.Dictionary`2"), new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2")])]), - $jsilcore.TypeRef("System.Collections.IEnumerable") + $jsilcore.TypeRef("System.Collections.IEnumerable"), + $jsilcore.TypeRef("System.Collections.Generic.IDictionary`2", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.Dictionary`2"), new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2")]), + $jsilcore.TypeRef("System.Collections.IDictionary"), + $jsilcore.TypeRef("System.Collections.Generic.ICollection`1", [$jsilcore.TypeRef("System.Collections.Generic.KeyValuePair`2", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.Dictionary`2"), new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2")])]), + $jsilcore.TypeRef("System.Collections.ICollection") ); }); From 6d2b8a77ebaca170bc2eb9a0bedb872f2d0569fd Mon Sep 17 00:00:00 2001 From: ik Date: Thu, 24 Apr 2014 20:08:09 -0700 Subject: [PATCH 2/2] Test added, problems fixed for Dictionary interface implementation. --HG-- extra : amend_source : 3632e24194f8836ca4bd3a16c72f3613ce84475f --- Libraries/JSIL.Bootstrap.js | 38 ++++++-- Tests/ComparisonTests.cs | 1 + Tests/TestCases/DictionaryInterfaces.cs | 113 ++++++++++++++++++++++++ Tests/Tests.csproj | 1 + 4 files changed, 146 insertions(+), 7 deletions(-) create mode 100644 Tests/TestCases/DictionaryInterfaces.cs diff --git a/Libraries/JSIL.Bootstrap.js b/Libraries/JSIL.Bootstrap.js index 547d2fad4..c1aab048b 100644 --- a/Libraries/JSIL.Bootstrap.js +++ b/Libraries/JSIL.Bootstrap.js @@ -2416,7 +2416,7 @@ JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+KeyCollection", ); $.Method({ Static: false, Public: true }, "GetEnumerator", - new JSIL.MethodSignature($jsilcore.TypeRef("System.Collections.Generic.IEnumerator`1", [new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2+ValueCollection")]), [], []), + new JSIL.MethodSignature($jsilcore.TypeRef("System.Collections.Generic.IEnumerator`1", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.Dictionary`2+KeyCollection")]), [], []), function GetEnumerator() { return JSIL.CreateInstanceOfType(this.dictionary.tKeyEnumerator, [this.dictionary]); } @@ -2508,7 +2508,8 @@ JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+KeyCollection+E function get_Current () { return this.kvpEnumerator.get_Current().key; } - ); + ) + .Overrides("System.Collections.Generic.IEnumerator`1", "get_Current"); $.Method({Static:false, Public:true , Virtual:true }, "MoveNext", new JSIL.MethodSignature($.Boolean, [], []), @@ -2523,7 +2524,7 @@ JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+KeyCollection+E return this.kvpEnumerator.get_Current().key; } ) - .Overrides(2, "get_Current"); + .Overrides("System.Collections.IEnumerator", "get_Current"); $.Method({Static:false, Public:false, Virtual:true }, "System.Collections.IEnumerator.Reset", new JSIL.MethodSignature(null, [], []), @@ -2531,7 +2532,7 @@ JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+KeyCollection+E this.kvpEnumerator = this.dictionary.GetEnumerator(); } ) - .Overrides(2, "Reset"); + .Overrides("System.Collections.IEnumerator", "Reset"); }); JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+ValueCollection+Enumerator", function ($interfaceBuilder) { @@ -2569,7 +2570,8 @@ JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+ValueCollection function get_Current () { return this.kvpEnumerator.get_Current().value; } - ); + ) + .Overrides("System.Collections.Generic.IEnumerator`1", "get_Current"); $.Method({Static:false, Public:true , Virtual:true }, "MoveNext", new JSIL.MethodSignature($.Boolean, [], []), @@ -2584,7 +2586,7 @@ JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+ValueCollection return this.kvpEnumerator.get_Current().value; } ) - .Overrides(2, "get_Current"); + .Overrides("System.Collections.IEnumerator", "get_Current"); $.Method({Static:false, Public:false, Virtual:true }, "System.Collections.IEnumerator.Reset", new JSIL.MethodSignature(null, [], []), @@ -2592,7 +2594,7 @@ JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+ValueCollection this.kvpEnumerator = this.dictionary.GetEnumerator(); } ) - .Overrides(2, "Reset"); + .Overrides("System.Collections.IEnumerator", "Reset"); }); JSIL.MakeStruct("System.ValueType", "System.Collections.Generic.KeyValuePair`2", true, ["TKey", "TValue"], function ($) { @@ -2677,6 +2679,12 @@ JSIL.MakeType({ GenericParameters: ["TKey", "TValue"], MaximumConstructorArguments: 1, }, function ($) { + $.ImplementInterfaces( + $jsilcore.TypeRef("System.Collections.Generic.ICollection`1", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.Dictionary`2+KeyCollection")]), + $jsilcore.TypeRef("System.Collections.ICollection"), + $jsilcore.TypeRef("System.Collections.Generic.IEnumerable`1", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.Dictionary`2+KeyCollection")]), + $jsilcore.TypeRef("System.Collections.IEnumerable") + ); }); JSIL.MakeType({ @@ -2687,6 +2695,12 @@ JSIL.MakeType({ GenericParameters: ["TKey", "TValue"], MaximumConstructorArguments: 1, }, function ($) { + $.ImplementInterfaces( + $jsilcore.TypeRef("System.Collections.Generic.ICollection`1", [new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2+ValueCollection")]), + $jsilcore.TypeRef("System.Collections.ICollection"), + $jsilcore.TypeRef("System.Collections.Generic.IEnumerable`1", [new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2+ValueCollection")]), + $jsilcore.TypeRef("System.Collections.IEnumerable") + ); }); JSIL.MakeType({ @@ -2697,6 +2711,11 @@ JSIL.MakeType({ GenericParameters: ["TKey", "TValue"], MaximumConstructorArguments: 1, }, function ($) { + $.ImplementInterfaces( + $jsilcore.TypeRef("System.Collections.Generic.IEnumerator`1", [new JSIL.GenericParameter("TKey", "System.Collections.Generic.Dictionary`2+KeyCollection+Enumerator")]), + $jsilcore.TypeRef("System.IDisposable"), + $jsilcore.TypeRef("System.Collections.IEnumerator") + ); }); JSIL.MakeType({ @@ -2707,6 +2726,11 @@ JSIL.MakeType({ GenericParameters: ["TKey", "TValue"], MaximumConstructorArguments: 1, }, function ($) { + $.ImplementInterfaces( + $jsilcore.TypeRef("System.Collections.Generic.IEnumerator`1", [new JSIL.GenericParameter("TValue", "System.Collections.Generic.Dictionary`2+KeyCollection+Enumerator")]), + $jsilcore.TypeRef("System.IDisposable"), + $jsilcore.TypeRef("System.Collections.IEnumerator") + ); }); JSIL.ImplementExternals("System.Collections.Generic.Dictionary`2+Enumerator", function ($interfaceBuilder) { diff --git a/Tests/ComparisonTests.cs b/Tests/ComparisonTests.cs index 92988da43..4dfb50487 100644 --- a/Tests/ComparisonTests.cs +++ b/Tests/ComparisonTests.cs @@ -271,6 +271,7 @@ public class ComparisonTests : GenericTestFixture { @"TestCases\DictionaryKeyValuePairs.cs", @"TestCases\DictionaryValueCollectionCount.cs", @"TestCases\DictionaryKeysAndValues.cs", + @"TestCases\DictionaryInterfaces.cs", }, MakeDefaultProvider(), new AssemblyCache() ); } diff --git a/Tests/TestCases/DictionaryInterfaces.cs b/Tests/TestCases/DictionaryInterfaces.cs new file mode 100644 index 000000000..f8fb8b471 --- /dev/null +++ b/Tests/TestCases/DictionaryInterfaces.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.Collections; + + +public static class Program { + public static void Main (string[] args) + { + var genericIDictionary = GetFilledGenericIDictionary(); + Console.WriteLine(genericIDictionary.Count); + foreach (var pair in genericIDictionary) + { + Console.WriteLine(pair.Key); + Console.WriteLine(pair.Value); + } + foreach (var value in genericIDictionary.Values) + { + Console.WriteLine(value); + } + foreach (var value in genericIDictionary.Keys) + { + Console.WriteLine(value); + } + + var iDictionary = GetFilledIDictionary(); + Console.WriteLine(iDictionary.Count); + foreach (var pair in genericIDictionary) + { + Console.WriteLine(pair.Key); + Console.WriteLine(pair.Value); + } + foreach (var value in iDictionary.Values) + { + Console.WriteLine(value); + } + foreach (var value in iDictionary.Keys) + { + Console.WriteLine(value); + } + + var genericICollection = GetFilledGenericICollection(); + Console.WriteLine(genericICollection.Count); + foreach (var pair in genericICollection) + { + Console.WriteLine(pair.Key); + Console.WriteLine(pair.Value); + } + + var iCollection = GetFilledICollection(); + Console.WriteLine(iCollection.Count); + foreach (var obj in iCollection) + { + var pair = (KeyValuePair) obj; + Console.WriteLine(pair.Key); + Console.WriteLine(pair.Value); + } + + var genericIEnumerable = GetFilledGenericIEnumerable(); + foreach (var pair in genericIEnumerable) + { + Console.WriteLine(pair.Key); + Console.WriteLine(pair.Value); + } + + var iEnumerable = GetFilledIEnumerable(); + foreach (var obj in iEnumerable) + { + var pair = (KeyValuePair)obj; + Console.WriteLine(pair.Key); + Console.WriteLine(pair.Value); + } + } + + public static IEnumerable GetFilledIEnumerable() + { + return CreateAndFill(); + } + + public static IEnumerable> GetFilledGenericIEnumerable() + { + return CreateAndFill(); + } + + public static ICollection GetFilledICollection() + { + return CreateAndFill(); + } + + public static ICollection> GetFilledGenericICollection() + { + return CreateAndFill(); + } + + public static IDictionary GetFilledIDictionary() + { + return CreateAndFill(); + } + + public static IDictionary GetFilledGenericIDictionary() + { + return CreateAndFill(); + } + + public static Dictionary CreateAndFill() + { + return new Dictionary { + {"a", 1}, + {"b", 2}, + {"z", 3}, + {"c", 4} + }; + } +} \ No newline at end of file diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 6a26d4e26..31c483739 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -826,6 +826,7 @@ +