public void CreateWithEnumerableParameterReturnsCorrectResult(
            Type argumentType)
        {
            var parameterInfo =
                typeof(SingleParameterType <>)
                .MakeGenericType(new[] { argumentType })
                .GetConstructors()
                .First()
                .GetParameters()
                .First();
            var expected = new object();
            var context  = new DelegatingSpecimenContext
            {
                OnResolve = r =>
                {
                    Assert.Equal(
                        new SeededRequest(
                            parameterInfo.ParameterType,
                            parameterInfo.Name),
                        r);
                    return(expected);
                }
            };
            var sut = new OmitEnumerableParameterRequestRelay();

            var actual = sut.Create(parameterInfo, context);

            Assert.Equal(expected, actual);
        }
        public void CreateWithNullContextThrows()
        {
            var sut = new OmitEnumerableParameterRequestRelay();

            Assert.Throws <ArgumentNullException>(
                () => sut.Create(new object(), null));
        }
        public void CreateReturnsCorrectResultForNonParameterRequest(
            object request)
        {
            var sut    = new OmitEnumerableParameterRequestRelay();
            var actual = sut.Create(request, new DelegatingSpecimenContext());

            Assert.Equal(new NoSpecimen(request), actual);
        }
        public void CreateWithNonEnumerableParameterRequestReturnsCorrectResult(
            Type argumentType)
        {
            var parameterInfo =
                typeof(SingleParameterType <>)
                .MakeGenericType(new[] { argumentType })
                .GetConstructors()
                .First()
                .GetParameters()
                .First();
            var sut = new OmitEnumerableParameterRequestRelay();

            var dummyContext = new DelegatingSpecimenContext();
            var actual       = sut.Create(parameterInfo, dummyContext);

            var expected = new NoSpecimen(parameterInfo);

            Assert.Equal(expected, actual);
        }
        public void CreateReturnsCorrectResultWhenContextReturnsOmitSpecimen(
            Type argumentType)
        {
            var parameterInfo =
                typeof(SingleParameterType <>)
                .MakeGenericType(new[] { argumentType })
                .GetConstructors()
                .First()
                .GetParameters()
                .First();
            var context = new DelegatingSpecimenContext
            {
                OnResolve = r => new OmitSpecimen()
            };
            var sut = new OmitEnumerableParameterRequestRelay();

            var actual = sut.Create(parameterInfo, context);

            var expected = Array.CreateInstance(
                argumentType.GetGenericArguments().Single(),
                0);

            Assert.Equal(expected, actual);
        }
        public void SutIsSpecimentBuilder()
        {
            var sut = new OmitEnumerableParameterRequestRelay();

            Assert.IsAssignableFrom <ISpecimenBuilder>(sut);
        }