Created
May 26, 2015 22:37
-
-
Save alistair/111540a8e9bc27d5b269 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Program | |
| { | |
| public HttpResponse BuildDeleteRequest(Action<HttpRequest> action) | |
| { | |
| var @object = new HttpRequest() | |
| { | |
| Method = "GET" | |
| }; | |
| action(@object); | |
| return @object.Execute(); | |
| } | |
| //public HttpResponse BuildDeleteFunc(Func<HttpRequest> func) | |
| //{ | |
| // HttpRequest @object = func(); | |
| // return @object.Execute(); | |
| //} | |
| static void Main(string[] args) | |
| { | |
| new Program().Test(); | |
| } | |
| public void Test() | |
| { | |
| var response = BuildDeleteRequest(RequestObjectMother.ConfigureAuthenticatedRequest); | |
| if (response.IsSuccessful) Console.ReadLine(); | |
| //BuildDeleteFunc(RequestObjectMother.ConfigureAuthenticatedRequestFunc); | |
| } | |
| } | |
| public static class RequestObjectMother | |
| { | |
| public static void ConfigureAuthenticatedRequest(HttpRequest httpRequest) | |
| { | |
| httpRequest.Headers.Add("Cookie", "fsdfsdfsdfdsf"); | |
| httpRequest.Headers.Add("ConversationId", "sfsdfsdfdsfdsfsdfdsfsd"); | |
| } | |
| //public static HttpRequest ConfigureAuthenticatedRequestFunc() | |
| //{ | |
| // var @object = new HttpRequest() | |
| // { | |
| // Method = "GET" | |
| // }; | |
| // @object.Headers.Add("Cookie", "fsdfsdfsdfdsf"); | |
| // @object.Headers.Add("ConversationId", "sfsdfsdfdsfdsfsdfdsfsd"); | |
| // return @object; | |
| //} | |
| } | |
| public class HttpRequest | |
| { | |
| public HttpRequest() | |
| { | |
| Headers = new Dictionary<string, string>(); | |
| } | |
| public string Uri { get; set; } | |
| public string Method { get; set; } | |
| public Dictionary<string, string> Headers { get; set; } | |
| public HttpResponse Execute() | |
| { | |
| return new HttpResponse() | |
| { | |
| IsSuccessful = true | |
| }; | |
| } | |
| } | |
| public class HttpResponse | |
| { | |
| public bool IsSuccessful { get; set; } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment