private void SetupPropertyExpectation(MethodInfo method, object[] args)
        {
            var methodName = method.Name;

            if (methodName.StartsWith(Constants.GET))
            {
                if (args.Any())                 //indexer
                {
                    GetIndexer(args);
                }
                else
                {
                    GetProperty(methodName.Substring(Constants.GET.Length));
                }
            }
            else if (methodName.StartsWith(Constants.SET))
            {
                if (args.Count() == 1)
                {
                    IValueSyntax valueSyntax = SetProperty(methodName.Substring(Constants.SET.Length));
                    valueSyntax.To(Is.EqualTo(args[0]));
                }
                else if (args.Count() > 1)                 //indexer
                {
                    IValueSyntax valueSyntax = SetIndexer(args.Take(args.Length - 1).ToArray());
                    valueSyntax.To(Is.EqualTo(args.Last()));
                }
            }
        }
        public IActionSyntax SetPropertyTo(Action <T> action)
        {
            MethodInfo method;

            object[] args;
            using (InvocationRecorder recorder = new InvocationRecorder())
            {
                try
                {
                    action(mock);
                }
// ReSharper disable EmptyGeneralCatchClause
                catch { }
// ReSharper restore EmptyGeneralCatchClause
                method = recorder.Invocation.Method;
                args   = recorder.Invocation.Arguments;
            }

            if (!method.IsProperty())
            {
                throw new InvalidOperationException("This method expects a property, not a method, or event.");
            }

            if (method.IsSpecialName && method.Name == Constants.SET_ITEM)
            {
                //properties have args when used as indexer like SetPropertyTo(m=>m.prop[1] = "d")
                IValueSyntax valueSyntax = SetIndexer(args.Take(args.Length - 1).ToArray());
                valueSyntax.To(Is.EqualTo(args.Last()));
            }
            else if (method.IsSpecialName && method.Name == Constants.GET_ITEM)
            {
                throw new InvalidOperationException("Using a property as a getter in the SetPropertyTo method is not supported.");
            }
            else
            {
                IValueSyntax valueSyntax = SetProperty(method.Name.Substring(Constants.SET.Length));
                valueSyntax.To(Is.EqualTo(args[0]));
            }

            return(this);
        }