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
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 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 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 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 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_an_issue : given.the_default_state | |
{ | |
...snip... | |
} | |
public static class given | |
{ | |
public abstract class the_default_state : SpecsFor<AddIssueController> | |
{ | |
protected User TestUser; |
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 interface IRepository<TEntity> | |
{ | |
void Save(TEntity entity); | |
IQueryable<TEntity> Query(); | |
} |
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 abstract class SpecsForWithData<T> : SpecsFor<T> where T : class | |
{ | |
protected User TestUser; | |
protected User CreatorUser; | |
protected Issue TestIssue; | |
protected Project TestProject; | |
protected override void Given() | |
{ | |
CreateUsers(); |
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 given | |
{ | |
public abstract class the_default_state : SpecsForWithData<AddIssueController> | |
{ | |
} | |
} |
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 InvoiceProcessorSpecs | |
{ | |
public class when_processing_an_invoice_with_helpers : SpecsFor<InvoiceProcessor> | |
{ | |
... | |
[Test] | |
public void then_it_publishes_an_event() | |
{ | |
GetMockFor<IPublisher>() |
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
[SetUpFixture] | |
public class DemoWebAppConfig : SpecsForMvcConfig | |
{ | |
public DemoWebAppConfig() | |
{ | |
UseIISExpressWith(Project("SpecsFor.Mvc.Demo")); | |
BuildRoutesUsing(r => MvcApplication.RegisterRoutes(r)); | |
UseBrowser(BrowserDriver.InternetExplorer); | |
//TODO: Open questions to be answered: |
OlderNewer