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 interface IRepository<TEntity> | |
{ | |
void Save(TEntity entity); | |
IQueryable<TEntity> Query(); | |
} |
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_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 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 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 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 given | |
{ | |
public abstract class the_default_state : SpecsForWithData<AddIssueController> | |
{ | |
} | |
} |
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 InvoiceProcessorSpecs | |
{ | |
public class when_processing_an_invoice_with_helpers : SpecsFor<InvoiceProcessor> | |
{ | |
... | |
[Test] | |
public void then_it_publishes_an_event() | |
{ | |
GetMockFor<IPublisher>() |
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
[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: |
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
protected override void Given() | |
{ | |
//Access Moq objects easily | |
GetMockFor<IInventory>() | |
.Setup(i => i.IsQuantityAvailable("TestPart", 10)) | |
.Returns(true) | |
.Verifiable(); | |
} | |
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
public class when_creating_the_SUT_manually : SpecsFor<ReallyComplexAndHardToCreateType> | |
{ | |
protected override void InitializeClassUnderTest() | |
{ | |
SUT = ReallyComplexAndHardToCreateType.CreateMyType("some", "params", 536); | |
} | |
... | |
} |
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 UserRegistrationSpecs | |
{ | |
public class when_a_new_user_registers : SpecsFor<MvcWebApp> | |
{ | |
protected override void Given() | |
{ | |
SUT.NavigateTo<AccountController>(c => c.Register()); | |
} | |
protected override void When() |
OlderNewer