Assuming you have the following object:
public class Person {
public string Name { get; set; }
public string Surname { get; set; }
public int Age { get; set; }
}
and got a PATCH request as below:
public class CustomDataAnnotationsModelValidatorProvider : DataAnnotationsModelValidatorProvider | |
{ | |
private readonly IServiceProvider serviceProvider; | |
public CustomDataAnnotationsModelValidatorProvider(IServiceProvider serviceProvider) | |
{ | |
this.serviceProvider = serviceProvider; | |
DataAnnotationsModelValidatorProvider.RegisterDefaultAdapterFactory( | |
(metadata, context, attribute) => |
Assuming you have the following object:
public class Person {
public string Name { get; set; }
public string Surname { get; set; }
public int Age { get; set; }
}
and got a PATCH request as below:
[TestMethod()] | |
public void Foo_should_start_mspaint() | |
{ | |
var cmdHandler = new Mock<ICommandHandler>(); | |
var qryHandler = new Mock<IQueryHandler>(); | |
var controller = new Controller(cmdHandler.Object, qryHandler.Object); | |
controller.Foo("mspaint.exe"); | |
namespace OAuthDemo.Controllers | |
{ | |
public static class SecurityConfig | |
{ | |
public static void Configure(HttpConfiguration httpConfiguration) | |
{ | |
var config = new AuthenticationConfiguration(); | |
config.DefaultAuthenticationScheme = "Basic"; | |
.ui-autocomplete { | |
position: absolute; | |
cursor: default; | |
list-style: none; | |
display: block; | |
outline: none; | |
padding: 5px 0; | |
margin: 2px 0 0; | |
background-color: @dropdownBackground; | |
border: 1px solid #ccc; // Fallback for IE7-8 |
public class LessTransform : IBundleTransform | |
{ | |
public void Process(BundleContext context, BundleResponse bundle) | |
{ | |
if (context == null) | |
{ | |
throw new ArgumentNullException("context"); | |
} | |
if (bundle == null) |
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
});
private static string[] GetCanonicalizedHeaders(HttpRequestHeaders headers) | |
{ | |
return headers | |
.Where(p => p.Key.StartsWith("x-ms-", StringComparison.InvariantCultureIgnoreCase)) | |
.Select(p => new { Name = p.Key.ToLower(), Value = p.Value.First() }) | |
.OrderBy(p => p.Name) | |
.Select(p => string.Format("{0}:{1}", p.Name, p.Value)) | |
.ToArray(); | |
} |
public static class CloudBlobExtensions | |
{ | |
/// <summary> | |
/// Uploads a string of text to a block blob. | |
/// </summary> | |
/// <param name="content">The text to upload, encoded as a UTF-8 string.</param> | |
public static void UploadText(this ICloudBlob blob, string content) | |
{ | |
UploadText(blob, content, Encoding.UTF8, null); | |
} |
public HttpContextBase FakeHttpContext() { | |
var context = new Mock<HttpContextBase>(); | |
var files = new Mock<HttpFileCollectionBase>(); | |
var request = new Mock<HttpRequestBase>(); | |
var response = new Mock<HttpResponseBase>(); | |
var session = new Mock<HttpSessionStateBase>(); | |
var server = new Mock<HttpServerUtilityBase>(); | |
var user = new Mock<IPrincipal>(); | |
var identity = new Mock<IIdentity>(); | |
request.Setup(req => req.ApplicationPath).Returns("~/"); |