diff --git a/Src/FluentAssertions/Common/ReadOnlyNonGenericCollectionWrapper.cs b/Src/FluentAssertions/Common/ReadOnlyNonGenericCollectionWrapper.cs index fe476343c6..a16632ad0a 100644 --- a/Src/FluentAssertions/Common/ReadOnlyNonGenericCollectionWrapper.cs +++ b/Src/FluentAssertions/Common/ReadOnlyNonGenericCollectionWrapper.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Data; +using System.Diagnostics; using System.Linq; namespace FluentAssertions.Common; @@ -33,7 +34,14 @@ internal static class ReadOnlyNonGenericCollectionWrapper } } -internal class ReadOnlyNonGenericCollectionWrapper : ICollection +/// +/// This type exists to serve internal functionality in FluentAssertions. It is marked public to allow it to be +/// referenced from packages that extend FluentAssertion's functionality. +/// +/// Collection type. +/// Item type. +[DebuggerNonUserCode] +public class ReadOnlyNonGenericCollectionWrapper : ICollection where TCollection : ICollection { public TCollection UnderlyingCollection { get; } diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net47.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net47.verified.txt index 8a2d1f8e14..6793cc6654 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net47.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net47.verified.txt @@ -647,6 +647,20 @@ namespace FluentAssertions.Common { System.TimeSpan Elapsed { get; } } + public class ReadOnlyNonGenericCollectionWrapper : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + where TCollection : System.Collections.ICollection + { + public ReadOnlyNonGenericCollectionWrapper(TCollection collection) { } + public int Count { get; } + public bool IsReadOnly { get; } + public TCollection UnderlyingCollection { get; } + public void Add(TItem item) { } + public void Clear() { } + public bool Contains(TItem item) { } + public void CopyTo(TItem[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { } + public bool Remove(TItem item) { } + } public static class Services { public static FluentAssertions.Common.Configuration Configuration { get; } diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net6.0.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net6.0.verified.txt index 1b6faed215..1fb1b7aa9c 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net6.0.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net6.0.verified.txt @@ -659,6 +659,20 @@ namespace FluentAssertions.Common { System.TimeSpan Elapsed { get; } } + public class ReadOnlyNonGenericCollectionWrapper : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + where TCollection : System.Collections.ICollection + { + public ReadOnlyNonGenericCollectionWrapper(TCollection collection) { } + public int Count { get; } + public bool IsReadOnly { get; } + public TCollection UnderlyingCollection { get; } + public void Add(TItem item) { } + public void Clear() { } + public bool Contains(TItem item) { } + public void CopyTo(TItem[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { } + public bool Remove(TItem item) { } + } public static class Services { public static FluentAssertions.Common.Configuration Configuration { get; } diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp2.1.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp2.1.verified.txt index a9f68eb68d..a8a05b409b 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp2.1.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp2.1.verified.txt @@ -647,6 +647,20 @@ namespace FluentAssertions.Common { System.TimeSpan Elapsed { get; } } + public class ReadOnlyNonGenericCollectionWrapper : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + where TCollection : System.Collections.ICollection + { + public ReadOnlyNonGenericCollectionWrapper(TCollection collection) { } + public int Count { get; } + public bool IsReadOnly { get; } + public TCollection UnderlyingCollection { get; } + public void Add(TItem item) { } + public void Clear() { } + public bool Contains(TItem item) { } + public void CopyTo(TItem[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { } + public bool Remove(TItem item) { } + } public static class Services { public static FluentAssertions.Common.Configuration Configuration { get; } diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp3.0.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp3.0.verified.txt index 8c7f8490bc..8567bce23d 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp3.0.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp3.0.verified.txt @@ -647,6 +647,20 @@ namespace FluentAssertions.Common { System.TimeSpan Elapsed { get; } } + public class ReadOnlyNonGenericCollectionWrapper : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + where TCollection : System.Collections.ICollection + { + public ReadOnlyNonGenericCollectionWrapper(TCollection collection) { } + public int Count { get; } + public bool IsReadOnly { get; } + public TCollection UnderlyingCollection { get; } + public void Add(TItem item) { } + public void Clear() { } + public bool Contains(TItem item) { } + public void CopyTo(TItem[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { } + public bool Remove(TItem item) { } + } public static class Services { public static FluentAssertions.Common.Configuration Configuration { get; } diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.0.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.0.verified.txt index 1fc893363c..ad9b85f839 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.0.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.0.verified.txt @@ -640,6 +640,20 @@ namespace FluentAssertions.Common { System.TimeSpan Elapsed { get; } } + public class ReadOnlyNonGenericCollectionWrapper : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + where TCollection : System.Collections.ICollection + { + public ReadOnlyNonGenericCollectionWrapper(TCollection collection) { } + public int Count { get; } + public bool IsReadOnly { get; } + public TCollection UnderlyingCollection { get; } + public void Add(TItem item) { } + public void Clear() { } + public bool Contains(TItem item) { } + public void CopyTo(TItem[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { } + public bool Remove(TItem item) { } + } public static class Services { public static FluentAssertions.Common.Configuration Configuration { get; } diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.1.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.1.verified.txt index dedd54bad1..7717c40c4a 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.1.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.1.verified.txt @@ -647,6 +647,20 @@ namespace FluentAssertions.Common { System.TimeSpan Elapsed { get; } } + public class ReadOnlyNonGenericCollectionWrapper : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + where TCollection : System.Collections.ICollection + { + public ReadOnlyNonGenericCollectionWrapper(TCollection collection) { } + public int Count { get; } + public bool IsReadOnly { get; } + public TCollection UnderlyingCollection { get; } + public void Add(TItem item) { } + public void Clear() { } + public bool Contains(TItem item) { } + public void CopyTo(TItem[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { } + public bool Remove(TItem item) { } + } public static class Services { public static FluentAssertions.Common.Configuration Configuration { get; }