This file contains 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
foreach (Type controller in typeof(OrderController).Assembly.GetTypes().Where(type => typeof(IHttpController).IsAssignableFrom(type))) | |
{ | |
// https://github.com/srkirkland/Inflector/blob/5fd4c818dd172bbe276fb210f25c2e2ceaff019e/Inflector/Inflector.cs | |
string name = Inflector.Pluralize(controller.Name.Replace("Controller", "")); | |
container.Register(Component | |
.For(controller) | |
.Named(name) | |
.LifestylePerWebRequest()); | |
} |
This file contains 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 static HttpSelfHostServer BuildHttpSelfHostServer(string baseAddress) | |
{ | |
var configuration = new HttpSelfHostConfiguration(baseAddress); | |
configuration.DependencyResolver = | |
new WindsorDependencyResolver( | |
new WindsorContainer() | |
.Install(new WebWindsorInstaller())); | |
configuration.Routes.MapHttpRoute( |
This file contains 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
// http://stackoverflow.com/questions/15558873/trouble-using-autofixtures-createproxy-to-use-likeness-semanticcomparison-feat | |
[Fact] | |
public void Equality_Behaves_As_Expected() | |
{ | |
var template = new Fixture().Create<Band>(); | |
var createdBand = new Band | |
{ | |
Brass = template.Brass, |
This file contains 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
// http://stackoverflow.com/questions/16145284/autofixture-how-to-express-the-following-code-declaratively/16145954?noredirect=1#16145284 | |
public class Tests | |
{ | |
[Theory] | |
[InlineAutoMockData(@"-o=C:\Temp\someFile -p=1")] | |
[InlineAutoMockData(@"-p=1 -o=C:\Temp\someFile")] | |
public void ParseMissingParameterShouldReturnCorrectResult( | |
string argsString, | |
SomeClass sut) |
This file contains 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
var create = require('edge').func(function () {/* | |
//#r "Ploeh.AutoFixture.dll" | |
using System; | |
using Ploeh.AutoFixture; | |
public class Startup | |
{ | |
public async System.Threading.Tasks.Task<object> Invoke(object request) |
This file contains 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
module SemanticEqualityComparisonInFSharp | |
open System | |
open System.Reflection | |
open Ploeh.SemanticComparison | |
open Xunit | |
open Xunit.Extensions | |
[<CustomEquality; NoComparison>] | |
type StructuralType = |
This file contains 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
internal class GreedyFactoryMethodQuery : IMethodQuery | |
{ | |
public IEnumerable<IMethod> SelectMethods(Type type) | |
{ | |
if (type == null) | |
throw new ArgumentNullException("type"); | |
return from mi in type.GetMethods( | |
BindingFlags.Static | BindingFlags.Public) | |
where mi.ReturnType == type |
This file contains 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
module Mountebank.Scenarios | |
// PM> Install-Package xunit | |
// PM> Install-Package Unquote | |
open System | |
open System.Net.Mail | |
open Xunit | |
let verify = Swensen.Unquote.Assertions.test |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>Custom matchers for Expressions</title> | |
<!-- $ bower install jasmine && npm install jsep --> | |
<link href="bower_components/jasmine/lib/jasmine-core/jasmine.css" rel="stylesheet" /> | |
<script src="bower_components/jasmine/lib/jasmine-core/jasmine.js"></script> |
This file contains 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
open FSharp.Data | |
open System | |
open System.Net | |
open Xunit | |
let verify = Swensen.Unquote.Assertions.test | |
[<Fact>] | |
[<UseImposterStub( | |
"192.168.1.4", |
OlderNewer