ModelBuilder.UnitTests.RandomGeneratorTests.NextValueWithTypeCanEvalutateManyTimesTest C# (CSharp) Method

NextValueWithTypeCanEvalutateManyTimesTest() private method

private NextValueWithTypeCanEvalutateManyTimesTest ( Type type, bool typeSupported, object min, object max ) : void
type Type
typeSupported bool
min object
max object
return void
        public void NextValueWithTypeCanEvalutateManyTimesTest(Type type, bool typeSupported, object min, object max)
        {
            if (typeSupported == false)
            {
                // Ignore this test
                return;
            }

            var target = new RandomGenerator();

            for (var index = 0; index < 100000; index++)
            {
                var value = target.NextValue(type, min, max);

                value.Should().NotBeNull();

                if (type.IsNullable())
                {
                    value.Should().BeOfType(type.GetGenericArguments()[0]);
                }
                else
                {
                    value.Should().BeOfType(type);
                }
            }
        }