Beispiel #1
0
    public IEnumerable <ServiceAction> GetActions(Type typeWithActions)
    {
        var actionInfos = ActionFinder.GetActionsFromType(typeWithActions).ToArray();

        foreach (var actionInfo in actionInfos)
        {
            var method = actionInfo.ActionMethod;

            var actionName  = method.Name;
            var returnType  = method.ReturnType == typeof(void) ? null : GetResourceType(method.ReturnType);
            var resourceSet = GetResourceSet(returnType);

            var parameters = GetParameters(method, actionInfo.Binding != OperationParameterBindingKind.Never);
            var action     = new ServiceAction(
                actionName,
                returnType,
                resourceSet,
                actionInfo.Binding,
                parameters
                )
            {
                // Store the method associated with this Action.
                CustomState = actionInfo
            };
            action.SetReadOnly();
            yield return(action);
        }
    }
Beispiel #2
0
 public void SetUp()
 {
     classUnderTest = new ActionFinder();
 }