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
| using NSubstitute; | |
| using NUnit.Framework; | |
| using System.Linq; | |
| using System.Web; | |
| using System.Web.Routing; | |
| namespace Fabrik.Web.Hosted.Specs | |
| { | |
| [TestFixture] | |
| public class InboundRouteTests |
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
| using System; | |
| using System.Collections.Concurrent; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using System.Threading.Tasks.Dataflow; | |
| namespace TDFDemo | |
| { | |
| class Program | |
| { |
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
| id: 3, | |
| uri: "http://storage.blob.core.windows.net/02a/image.jpg", | |
| title: "ddd", | |
| mediaType: "Image", | |
| links: [ | |
| { | |
| rel: "edit", | |
| href: "https://api.onfabrik.com/sites/1/projects/85/media/3" | |
| } | |
| { |
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
| { | |
| "Name": "ProjectsPageSize", | |
| "DisplayName": "Projects Page Size", | |
| "DefaultValue": 15, | |
| "Description": "The page size (number of projects) for the project list page.", | |
| "IsReadOnly": false, | |
| "IsRequired": true, | |
| "UIHint": null, | |
| "ValidationRule": "^[1-9][0-9]*$" | |
| } |
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
| public class Bootstrapper : DefaultNancyBootstrapper | |
| { | |
| protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) | |
| { | |
| base.ApplicationStartup(container, pipelines); | |
| this.Conventions.ViewLocationConventions.Add((viewName, model, context) => | |
| { | |
| var theme = context.Context.Items["Theme"] as string; | |
| return string.Concat("themes/", theme, "/views/", viewName); |
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
| private async Task<ApiResponse<TResult>> ReadResponseAsync<TResult>(HttpResponseMessage response) | |
| { | |
| Ensure.Argument.NotNull(response, "response"); | |
| var apiResponse = new ApiResponse<TResult>(); | |
| if (response.IsSuccessStatusCode) | |
| { | |
| apiResponse.Content = await response.Content.ReadAsAsync<TResult>().ConfigureAwait(false); | |
| } | |
| else |
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
| public static class HttpErrorExtensions | |
| { | |
| public static ModelStateDictionary GetModelState(this HttpError httpError) | |
| { | |
| Ensure.Argument.NotNull(httpError, "httpError"); | |
| object serialized; | |
| if (httpError.TryGetValue("ModelState", out serialized)) | |
| { | |
| var modelState = new ModelStateDictionary(); |
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
| using System; | |
| using System.Collections.Concurrent; | |
| using System.Collections.Generic; | |
| using System.ComponentModel.DataAnnotations; | |
| using System.Linq; | |
| using System.Net; | |
| using System.Net.Http; | |
| using System.Web.Http; | |
| using System.Web.Http.Controllers; | |
| using System.Web.Http.Dependencies; |
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
| using StructureMap; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.ComponentModel.DataAnnotations; | |
| using System.Linq; | |
| using System.Web.Http; | |
| using System.Web.Mvc; | |
| using System.Web.Optimization; | |
| using System.Web.Routing; | |
| using ValidationDemo.Application; |
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
| ApiClient apiClient; | |
| // create from connection string in web/app config | |
| apiClient = ApiClient.FromConnectionString("api"); | |
| // parse in memory connection string | |
| apiClient = ApiClient.ParseConnectionString( | |
| "url=https://api.local.com;username=test;password=test;"); | |
| // use fluent expression |