AutoBogus
AutoBogus copied to clipboard
[Bug] Faking List<MemoryStream> throws ArgumentOutOfRangeException
Given the following code
[Fact]
public void TestAutoBogus()
{
var testData = AutoFaker.Generate<TestData>();
testData.Should().NotBeNull();
}
private class TestData
{
public List<MemoryStream> BinaryListValues { get; set; }
}
- Expected: Green Test
- Actual: ArgumentOutOfRangeException
System.ArgumentOutOfRangeException
The initialCount argument must be non-negative and less than or equal to the maximumCount. (Parameter 'initialCount')
Actual value was -1985685215.
at System.Threading.SemaphoreSlim..ctor(Int32 initialCount, Int32 maxCount)
at System.Threading.SemaphoreSlim..ctor(Int32 initialCount)
AutoBogus.FakeItEasy: 2.13.1 AutoBogus: 2.13.1 Bogus: 31.0.3
Looks like it fails when it instantiates the SemaphoreSlim _asyncActiveSemaphore
of the MemoryStream. It only accepts a positive int as parameter. Not sure, if this can easily fixed.
I "solved" it by .WithSkip<MemoryStream>().WithSkip<List<MemoryStream>>()
@ledux FYI I just implemented a MemoryStreamGenerator
in soenneker.utils.autobogus which actually generates MemoryStreams. Thanks