diff --git a/src/TestFixture.Tests/CollectionsTests.cs b/src/TestFixture.Tests/CollectionsTests.cs index 3f91b74..766e2e4 100644 --- a/src/TestFixture.Tests/CollectionsTests.cs +++ b/src/TestFixture.Tests/CollectionsTests.cs @@ -269,6 +269,40 @@ public void IImmutableQueueTest() fixture.Create>().Should().BeEquivalentTo(expected); } + [TestMethod] + public void ConcurrentBagTest() + { + var expected = new List { 1, 2, 3 }; + var fixture = new TestFixtureBuilder() + .With(1, 2, 3) + .Build(); + + fixture.Create>().Should().BeEquivalentTo(expected); + } + + + [TestMethod] + public void ConcurrentQueueFactoryTest() + { + var expected = new List { 1, 2, 3 }; + var fixture = new TestFixtureBuilder() + .With(1, 2, 3) + .Build(); + + fixture.Create>().Should().BeEquivalentTo(expected); + } + + [TestMethod] + public void ConcurrentStackTest() + { + var expected = new List { 1, 2, 3 }; + var fixture = new TestFixtureBuilder() + .With(1, 2, 3) + .Build(); + + fixture.Create>().Should().BeEquivalentTo(expected); + } + #if NET [TestMethod] public void FrozenDictionaryTest() diff --git a/src/TestFixture/Factories/Collections/Concurrent/ConcurrentBagFactory.cs b/src/TestFixture/Factories/Collections/Concurrent/ConcurrentBagFactory.cs new file mode 100644 index 0000000..83e01b0 --- /dev/null +++ b/src/TestFixture/Factories/Collections/Concurrent/ConcurrentBagFactory.cs @@ -0,0 +1,11 @@ +using System.Collections.Concurrent; + +namespace TestFixture.Factories.Collections.Concurrent; + +internal sealed class ConcurrentBagFactory : IFactory +{ + public object Create(Fixture fixture) + { + return new ConcurrentBag(fixture.Create(3)); + } +} diff --git a/src/TestFixture/Factories/Collections/Concurrent/ConcurrentQueueFactory.cs b/src/TestFixture/Factories/Collections/Concurrent/ConcurrentQueueFactory.cs new file mode 100644 index 0000000..b037f77 --- /dev/null +++ b/src/TestFixture/Factories/Collections/Concurrent/ConcurrentQueueFactory.cs @@ -0,0 +1,11 @@ +using System.Collections.Concurrent; + +namespace TestFixture.Factories.Collections.Concurrent; + +internal sealed class ConcurrentQueueFactory : IFactory +{ + public object Create(Fixture fixture) + { + return new ConcurrentQueue(fixture.Create(3)); + } +} diff --git a/src/TestFixture/Factories/Collections/Concurrent/ConcurrentStackFactory.cs b/src/TestFixture/Factories/Collections/Concurrent/ConcurrentStackFactory.cs new file mode 100644 index 0000000..679ba13 --- /dev/null +++ b/src/TestFixture/Factories/Collections/Concurrent/ConcurrentStackFactory.cs @@ -0,0 +1,11 @@ +using System.Collections.Concurrent; + +namespace TestFixture.Factories.Collections.Concurrent; + +internal sealed class ConcurrentStackFactory : IFactory +{ + public object Create(Fixture fixture) + { + return new ConcurrentStack(fixture.Create(3)); + } +} diff --git a/src/TestFixture/SharedFixtureState.cs b/src/TestFixture/SharedFixtureState.cs index a9a0b99..33bec19 100644 --- a/src/TestFixture/SharedFixtureState.cs +++ b/src/TestFixture/SharedFixtureState.cs @@ -63,6 +63,9 @@ internal static class SharedFixtureState new GenericFactory(typeof(Stack<>), typeof(StackFactory<>)), new GenericFactory(typeof(ConcurrentDictionary<,>), typeof(ConcurrentDictionaryFactory<,>)), + new GenericFactory(typeof(ConcurrentQueue<>), typeof(ConcurrentQueueFactory<>)), + new GenericFactory(typeof(ConcurrentBag<>), typeof(ConcurrentBagFactory<>)), + new GenericFactory(typeof(ConcurrentStack<>), typeof(ConcurrentStackFactory<>)), new GenericFactory(typeof(IEnumerable<>), typeof(ListFactory<>)), new GenericFactory(typeof(IAsyncEnumerable<>), typeof(AsyncEnumerableFactory<>)),