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
public class Task<T> | |
{ | |
readonly T something; | |
public Task(T something) | |
{ | |
this.something = something; | |
} | |
} |
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 result = Controller.Create(...); | |
result.ShouldBeRedirectTo("Customers", "Index"); | |
// instead of: | |
var result = Controller.Create(...); | |
var redirectResult = result as RedirectResult; |
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
public class ArrayModelBinder : IFilteredPropertyBinder | |
{ | |
private static readonly Regex IdRegex = new Regex("(?<=_)[0-9]+(?=_)"); | |
public bool IsMatch(Type modelType) | |
{ | |
return modelType.IsArray; | |
} | |
public void BindProperty(IModelBinder binder, ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor) |
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 validator = $('form').validate({ | |
rules: { | |
number: { | |
remote: { | |
url: 'UniqueNumber', | |
dataType: 'json', | |
success: function(data) { | |
if (data.unique == true) { | |
return; | |
} |
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
public class SomeService | |
{ | |
public string GetValues() | |
{ | |
return "huzzah"; | |
} | |
} | |
public class Person | |
{ |
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
Fluently.Configure() | |
.Mappings(...) | |
.Database(...) | |
.Diagnostics(dia => | |
{ | |
dia.Enable(); | |
dia.OutputToConsole(); | |
}) | |
.BuildSessionFactory(); |
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
Fluent Mappings | |
--------------- | |
Sources scanned: | |
Examples.FirstProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null | |
Mappings discovered: | |
EmployeeMap | Examples.FirstProject.Mappings.EmployeeMap, Examples.FirstProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null |
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
public static class RhinoMocksExtensions | |
{ | |
public static IMethodOptions<IEnumerable<T>> ReturnEmptySet<T>(this IMethodOptions<IEnumerable<T>> options) | |
{ | |
return options.Return(new T[0]); | |
} | |
} |
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
public class MyAutomappingConfiguration : DefaultAutomappingConfiguration | |
{ | |
public override bool ShouldMap(Member member) | |
{ | |
return base.ShouldMap(member) && member.CanWrite; | |
} | |
} |
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
// boom | |
public class Ex | |
{ | |
public static readonly Ex Foo = Parse('f'); | |
public static readonly Ex Bar = Parse('b'); | |
Dictionary<char, string> validValues = new Dictionary<char, string> | |
{ | |
{ 'f', "Foo" }, | |
{ 'b', "Bar" }, |