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.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Web.UI; | |
using HeroicCRM.Web.Utilities; | |
using HtmlTags; | |
namespace HeroicCRM.Web.Helpers | |
{ |
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
$StandardGitIgnoreFile = Resolve-Path ".\std.gitignore" | |
function Git-InitStandard() { | |
git init . | |
Copy-Item $StandardGitIgnoreFile ".\.gitignore" | |
Write-Host "Added standard gitignore file." | |
} | |
<# | |
This assumes you have a file next to your Powershell profile (where this function is defined) named std.gitignore. Here's what's in mine: |
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 SpecsFor; | |
public class OrderProcessorSpecs : SpecsFor<OrderProcessor> | |
{ | |
ProcessingResult _result; | |
protected override void Given() | |
{ | |
GetMockFor<IInventory>() | |
.Setup(i => i.IsQuantityAvailable("TestPart", 10)) | |
.Returns(true) |
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 SpecsFor; | |
public class OrderProcessorSpecs : SpecsFor<OrderProcessor> | |
{ | |
[Test] | |
public void Order_submitted_successfully_Tests() | |
{ | |
GetMockFor<IInventory>() | |
.Setup(i => i.IsQuantityAvailable("TestPart", 10)) | |
.Returns(true) | |
.Verifiable(); |
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.Web.Mvc; | |
namespace HeroicSupport.Web.Filters | |
{ | |
public class StandardModelStateValidationAttribute : ActionFilterAttribute | |
{ | |
public override void OnActionExecuting(ActionExecutingContext filterContext) | |
{ | |
if (!filterContext.Controller.ViewData.ModelState.IsValid) | |
{ |
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 ModularConventionViewEngine : RazorViewEngine | |
{ | |
//This needs to be initialized to the root namespace of your MVC project. | |
//Usually, the namespace of your Global.asax's codebehind will do the trick. | |
private static readonly string RootNamespace = typeof(MvcApplication).Namespace; | |
private static IEnumerable<string> GetPath(ControllerContext controllerContext, string viewName) | |
{ | |
var paths = new List<string>(); |
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 StructureMapDecoratorHelperExtension | |
{ | |
public static DecoratorHelper<TTarget> Decorate<TTarget>(this SmartInstance<TTarget> instance) | |
{ | |
return new DecoratorHelper<TTarget>(instance); | |
} | |
} | |
public class DecoratorHelper<TTarget> |
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 UserRegistrationSpecs | |
{ | |
public class when_a_new_user_registers : SpecsFor<MvcWebApp> | |
{ | |
protected override void Given() | |
{ | |
SUT.NavigateTo<AccountController>(c => c.Register()); | |
} | |
protected override void When() |
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
[Given(typeof(the_entity_is_available))] | |
public class When_entity_is_on_hold : SpecsFor<Entity> | |
{ | |
public When_entity_is_on_hold(Type[] contexts) : base(contexts) { } | |
protected override void InitializeClassUnderTest() | |
{ | |
SUT = new Entity("test"); | |
} |
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 when_creating_the_SUT_manually : SpecsFor<ReallyComplexAndHardToCreateType> | |
{ | |
protected override void InitializeClassUnderTest() | |
{ | |
SUT = ReallyComplexAndHardToCreateType.CreateMyType("some", "params", 536); | |
} | |
... | |
} |
NewerOlder