private void ExtractInvocation(ParameterExpression command, ParameterExpression annotator, MethodCallExpression invex)
        {
            if (invex.Object == annotator)
            {
                if (invex.Method == AnnotatorMethods.AssertionsMethod)
                {
                    var conv = Expression.Convert(invex.Arguments[0], typeof(object));
                    var lamb = Expression.Lambda(conv, command);
                    var le   = lamb.Compile();
                    var cA   = new AssertionCheckParameter()
                    {
                        Extractor = le,
                        Type      = invex.Arguments[0].Type
                    };
                    _checkParameters.Add(cA);
                    return;
                }
            }

            var lambda = Expression.Lambda(invex, command).Compile();
            var cC     = new CommandExtractCheckParameter()
            {
                Type      = invex.Type,
                Extractor = lambda
            };

            _checkParameters.Add(cC);
        }
        private void ExtractMember(ParameterExpression pe, MemberExpression me)
        {
            var lambda = Expression.Lambda(me, pe).Compile();
            var cC     = new CommandExtractCheckParameter()
            {
                Type      = me.Type,
                Extractor = lambda
            };

            _checkParameters.Add(cC);
        }
        private void ExtractConstant(ParameterExpression pe, ConstantExpression ce)
        {
            var lambda = Expression.Lambda(ce, pe).Compile();
            var cC     = new CommandExtractCheckParameter()
            {
                Type      = ce.Type,
                Extractor = lambda
            };

            _checkParameters.Add(cC);
        }
        private ExpressionSyntax ExtractFromCommand(CommandBase command, CommandExtractCheckParameter cecp)
        {
            var value = cecp.Extractor.DynamicInvoke(command);
            ExpressionSyntax result;
            if (cecp.Type.IsInlineable())
            {
                EnsureUsing(cecp.Type);
                result = TypeInitConstructor.Construct(cecp.Type, value);
            }
            else
            {
                throw new Exception($"{cecp.Type} is not inlineable into tests");
            }

            return result;
        }
        private ExpressionSyntax ExtractFromCommand(CommandBase command, CommandExtractCheckParameter cecp)
        {
            var value = cecp.Extractor.DynamicInvoke(command);

            if (value == null)
            {
                return(TypeInitConstructor.Null());
            }

            var type = value.GetType();
            ExpressionSyntax result;

            if (type.IsInlineable())
            {
                EnsureUsing(cecp.Type);
                result = TypeInitConstructor.Construct(cecp.Type, value);
            }
            else
            {
                if (type.IsDictionary())
                {
                    var(keyType, valueType) = type.GetDictionaryParameters();
                    if (keyType != null && valueType != null && keyType.IsInlineable())
                    {
                        return(MakeDictionary(value as IDictionary, keyType, valueType));
                    }
                }
                else if (type.IsCollection())
                {
                    var elementType = type.GetCollectionElementType();
                    if (elementType != null && elementType.IsInlineable())
                    {
                        return(MakeCollection(value as IEnumerable, elementType));
                    }
                }
                throw new Exception($"Can not inline {type} into tests");
            }

            return(result);
        }