From b83fdcf0c8a91af26220bd68da0d259c72317e52 Mon Sep 17 00:00:00 2001 From: ChanyaKushima <63221603+ChanyaVRC@users.noreply.github.com> Date: Sun, 31 Jul 2022 18:35:49 +0900 Subject: [PATCH 1/3] Add test for #17. --- .../Collections/OscParameterCollectionTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/vrcosclib.Test/Collections/OscParameterCollectionTests.cs b/src/vrcosclib.Test/Collections/OscParameterCollectionTests.cs index 760e02d..c7d4984 100644 --- a/src/vrcosclib.Test/Collections/OscParameterCollectionTests.cs +++ b/src/vrcosclib.Test/Collections/OscParameterCollectionTests.cs @@ -263,4 +263,14 @@ void TestEvent(IReadOnlyOscParameterCollection sender, ParameterChangedEventArgs pararmeters[Address1] = 60; Assert.AreEqual(0, calledCount); } + + [Test] + public void TestLinq() + { + var pararmeters = CreateParameterCollectionForTest(); + pararmeters["/address/to/parameter1"] = 10; + pararmeters["/address/to/parameter2"] = 10f; + pararmeters["/address/to/parameter3"] = false; + Assert.DoesNotThrow(() => pararmeters.OrderBy(v => v.Key)); + } } From 52663dcb9d5f1aa15cb09aef97918137eec3af58 Mon Sep 17 00:00:00 2001 From: ChanyaKushima <63221603+ChanyaVRC@users.noreply.github.com> Date: Sun, 31 Jul 2022 18:36:06 +0900 Subject: [PATCH 2/3] Fixed #17. --- src/vrcosclib/Collections/OscParameterCollection.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vrcosclib/Collections/OscParameterCollection.cs b/src/vrcosclib/Collections/OscParameterCollection.cs index f38245b..bd9bc16 100644 --- a/src/vrcosclib/Collections/OscParameterCollection.cs +++ b/src/vrcosclib/Collections/OscParameterCollection.cs @@ -81,12 +81,13 @@ public bool Remove(string key) void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) { - throw new NotSupportedException(); + ((ICollection>)_items).CopyTo(array, arrayIndex); } bool ICollection>.Remove(KeyValuePair item) { - throw new NotSupportedException(); + return ((ICollection>)_items).Remove(item); } + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); #endregion From 08655bcd605197385c32b71f0a680791c10c7195 Mon Sep 17 00:00:00 2001 From: ChanyaKushima <63221603+ChanyaVRC@users.noreply.github.com> Date: Sun, 31 Jul 2022 20:08:34 +0900 Subject: [PATCH 3/3] Fixed test. --- src/vrcosclib.Test/Collections/OscParameterCollectionTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vrcosclib.Test/Collections/OscParameterCollectionTests.cs b/src/vrcosclib.Test/Collections/OscParameterCollectionTests.cs index c7d4984..2072543 100644 --- a/src/vrcosclib.Test/Collections/OscParameterCollectionTests.cs +++ b/src/vrcosclib.Test/Collections/OscParameterCollectionTests.cs @@ -271,6 +271,6 @@ public void TestLinq() pararmeters["/address/to/parameter1"] = 10; pararmeters["/address/to/parameter2"] = 10f; pararmeters["/address/to/parameter3"] = false; - Assert.DoesNotThrow(() => pararmeters.OrderBy(v => v.Key)); + Assert.DoesNotThrow(() => pararmeters.OrderBy(v => v.Key).ToArray()); } }