Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
namespace System.Web.Http
{
public class ActionAttributeTestController : ApiController
{
[HttpGet]
public void RetriveUsers() { }
[HttpPost]
public void AddUsers(int id) { }
[HttpPut]
public void UpdateUsers(User user) { }
[HttpDelete]
[ActionName("DeleteUsers")]
public void RemoveUsers(string name) { }
[HttpOptions]
public void Help(int id) { }
[HttpHead]
public void Ping(int id) { }
[HttpPatch]
public void Update(int id) { }
[AcceptVerbs("PATCH", "HEAD")]
[CLSCompliant(false)]
public void Users(double key) { }
[NonAction]
public void NonAction() { }
[NonAction]
[AcceptVerbs("ACTION")]
public void NonActionWitHttpMethod() { }
public void Options() { }
public void Head() { }
public void PatchUsers() { }
}
}

View File

@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System.Collections.Generic;
namespace System.Web.Http
{
public class ParameterAttributeController : ApiController
{
public User GetUserByMyId(int myId) { return null; }
public User GetUser([FromUri(Name = "id")] int myId) { return null; }
public List<User> PostUserNameFromUri(int id, [FromUri]string name) { return null; }
public List<User> PostUserNameFromBody(int id, [FromBody] string name) { return null; }
public void DeleteUserWithNullableIdAndName(int? id, string name) { }
public void DeleteUser(string address) { }
}
}

View File

@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System.Collections.Generic;
namespace System.Web.Http
{
public class TestController : ApiController
{
public User GetUser(int id) { return null; }
public List<User> GetUsers() { return null; }
public List<User> GetUsersByName(string name) { return null; }
[AcceptVerbs("PATCH")]
public void PutUser(User user) { }
public User GetUserByNameAndId(string name, int id) { return null; }
public User GetUserByNameAndAge(string name, int age) { return null; }
public User GetUserByNameAgeAndSsn(string name, int age, int ssn) { return null; }
public User GetUserByNameIdAndSsn(string name, int id, int ssn) { return null; }
public User GetUserByNameAndSsn(string name, int ssn) { return null; }
public User PostUser(User user) { return null; }
public User PostUserByNameAndAge(string name, int age) { return null; }
public User PostUserByName(string name) { return null; }
public User PostUserByNameAndAddress(string name, UserAddress address) { return null; }
public User DeleteUserByIdAndOptName(int id, string name = "DefaultName") { return null; }
public User DeleteUserByIdNameAndAge(int id, string name, int age) { return null; }
}
}

View File

@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
namespace System.Web.Http
{
public class User
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
namespace System.Web.Http
{
public class UserAddress
{
public string Street;
public int ZipCode;
}
}

View File

@@ -0,0 +1,47 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
namespace System.Web.Http
{
public class UsersController : ApiController
{
// Undecorated action, following convention
public string GetUser() { return "GetUser"; }
// Undecorated action, not following conventions
public string Approve() { return "Approve"; }
// Action decorated with Verb only, following conventions
[AcceptVerbs("UPDATE")]
public string PutUser() { return "PutUser"; }
// Action decorated with Name = "" only, following conventions, not reachable by {action}
[ActionName("")]
public string PutUserWithEmptyName() { return "PutUserWithEmptyName"; }
// Action decorated with Name = "" only, not following conventions, it's a POST by default and not reachable by {action}
[ActionName("")]
public string DefaultActionWithEmptyActionName() { return "DefaultActionWithEmptyActionName"; }
// Action decorated with Name only, following conventions
[ActionName("UpdateUser")]
public string PostUser() { return "PostUser"; }
// Action decorated with both, following conventions
[AcceptVerbs("PATCH")]
[ActionName("ReplaceUser")]
public string DeleteUser() { return "DeleteUser"; }
// Action decorated with Verb only, not following conventions
[HttpDelete]
public string Remove() { return "Remove"; }
// Action decorated with Name only, not following conventions
[ActionName("Reject")]
public string Deny() { return "Deny"; }
// Action decorated with both, not following conventions
[AcceptVerbs("OPTIONS")]
[ActionName("Help")]
public string Assist() { return "Assist"; }
}
}