Created
June 16, 2014 20:42
-
-
Save MattHoneycutt/173cf7a4e403266733fa to your computer and use it in GitHub Desktop.
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) | |
.Verifiable(); | |
} | |
protected override void When() | |
{ | |
_result = SUT.Process(new Order {PartNumber = "TestPart", Quantity = 10}); | |
} | |
[Test] | |
public void then_the_order_is_accepted() | |
{ | |
_result.WasAccepted.ShouldBeTrue(); | |
} | |
[Test] | |
public void then_it_checks_the_quantity() | |
{ | |
GetMockFor<IInventory>().Verify(); | |
} | |
[Test] | |
public void then_it_raises_a_new_event() | |
{ | |
GetMockFor<IPublisher>() | |
.Verify(p => p.Publish(It.Is<OrderSubmitted>(o => o.OrderNumber == result.OrderNumber))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment