From 19dc7f6c8c3cc3efc0e6bfdddd289b9d3faefb6c Mon Sep 17 00:00:00 2001 From: BL <2988015+BL323@users.noreply.github.com> Date: Fri, 15 Apr 2022 09:18:04 +0100 Subject: [PATCH] Support IReadOnlyCollection binding for ListValueRetriever (#2584) --- TechTalk.SpecFlow/Assist/ValueRetrievers/ListValueRetriever.cs | 3 ++- .../AssistTests/ValueRetrieverTests/ListRetrieverTests.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/TechTalk.SpecFlow/Assist/ValueRetrievers/ListValueRetriever.cs b/TechTalk.SpecFlow/Assist/ValueRetrievers/ListValueRetriever.cs index 7afe56e80..21fe592dd 100644 --- a/TechTalk.SpecFlow/Assist/ValueRetrievers/ListValueRetriever.cs +++ b/TechTalk.SpecFlow/Assist/ValueRetrievers/ListValueRetriever.cs @@ -22,7 +22,8 @@ public override bool CanRetrieve(KeyValuePair keyValuePair, Type || genericType == typeof(IEnumerable<>) || genericType == typeof(ICollection<>) || genericType == typeof(IList<>) - || genericType == typeof(IReadOnlyList<>); + || genericType == typeof(IReadOnlyList<>) + || genericType == typeof(IReadOnlyCollection<>); } protected override Type GetActualValueType(Type propertyType) diff --git a/Tests/TechTalk.SpecFlow.RuntimeTests/AssistTests/ValueRetrieverTests/ListRetrieverTests.cs b/Tests/TechTalk.SpecFlow.RuntimeTests/AssistTests/ValueRetrieverTests/ListRetrieverTests.cs index 7f8589ba9..c0e77d28d 100644 --- a/Tests/TechTalk.SpecFlow.RuntimeTests/AssistTests/ValueRetrieverTests/ListRetrieverTests.cs +++ b/Tests/TechTalk.SpecFlow.RuntimeTests/AssistTests/ValueRetrieverTests/ListRetrieverTests.cs @@ -21,6 +21,7 @@ protected override IEnumerable BuildPropertyTypes(Type valueType) typeof(IList<>), typeof(List<>), typeof(IReadOnlyList<>), + typeof(IReadOnlyCollection<>), }; return propertyTypeDefinitions.Select(x => x.MakeGenericType(valueType));