private void FinderReturns(bool value)
        {
            if (!value)
            {
                _finder.TryFindArgumentNullException(Arg.Any <Exception> ( ),
                                                     out Arg.Any <ArgumentNullException> ( ))
                .Returns(x =>
                {
                    x [1] = null;

                    return(false);
                });
            }
            else
            {
                _finder.TryFindArgumentNullException(Arg.Any <Exception> ( ),
                                                     out Arg.Any <ArgumentNullException> ( ))
                .Returns(x =>
                {
                    x [1] = new ArgumentNullException(ParameterName);

                    return(true);
                });
            }
        }
        private object CreateInstance(IArgumentsGenerator generator,
                                      Type type)
        {
            try
            {
                return(generator.CreateArgument(type));
            }
            catch (Exception e)
            {
                if (!_finder.TryFindArgumentNullException(e, out var nullException))
                {
                    throw;
                }

                throw nullException;
            }
        }
Пример #3
0
        private object Factory(IArgumentsGenerator generator,
                               Type type)
        {
            try
            {
                ProcessAutoTestDataParameters(generator);

                var argument = CreateSut(generator, type);

                return(argument);
            }
            catch (Exception e)
            {
                if (!_exceptionFinder.TryFindArgumentNullException(e, out var nullException))
                {
                    throw;
                }

                throw nullException;
            }
        }