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
SetCapsLockState, AlwaysOff | |
+CapsLock::CapsLock | |
CapsLock::Send, {Ctrl down}{Shift down}{Shift up}{Ctrl up}{Ctrl up} | |
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
private void PlaceOrderWithFulfillmentService(ShoppingCart shoppingCart, Customer customer) | |
{ | |
//Open Session | |
var orderFulfillmentSessionId = OpenOrderFulfillmentSession(); | |
var firstItemId = shoppingCart.Items[0].ItemId; | |
var firstItemQuantity = shoppingCart.Items[0].Quantity; | |
//Check Inventory Level | |
var itemIsInInventory = _orderFulfillmentService.IsInInventory(orderFulfillmentSessionId, firstItemId, firstItemQuantity); |
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
private void PlaceOrderWithFulfillmentService(ShoppingCart shoppingCart, Customer customer) | |
{ | |
//Open Session | |
var orderFulfillmentSessionId = OpenOrderFulfillmentSession(); | |
var firstItemId = shoppingCart.Items[0].ItemId; | |
var firstItemQuantity = shoppingCart.Items[0].Quantity; | |
//Check Inventory Level | |
var itemIsInInventory = _orderFulfillmentService.IsInInventory(orderFulfillmentSessionId, firstItemId, firstItemQuantity); |
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 Guid PlaceOrder(Guid customerId, ShoppingCart shoppingCart) | |
{ | |
foreach (var item in shoppingCart.Items) | |
{ | |
if (item.Quantity == 0) | |
{ | |
throw new InvalidOrderException(); | |
} | |
} |
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 Guid PlaceOrder(Guid customerId, ShoppingCart shoppingCart) | |
{ | |
foreach (var item in shoppingCart.Items) | |
{ | |
if (item.Quantity == 0) | |
{ | |
throw new InvalidOrderException(); | |
} | |
} | |
var customer = _customerService.GetCustomer(customerId); |
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
[TestFixtureSetUp] | |
public void SetupTestFixture() | |
{ | |
_orderDataService = Mock.Create(); | |
_customerService = Mock.Create(); | |
_orderFulfillmentService = Mock.Create(); | |
_orderService = new OrderService(_orderDataService, _customerService, _orderFulfillmentService); | |
} |
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
namespace TddStore.Core | |
{ | |
public class OrderService | |
{ | |
private IOrderDataService _orderDataService; | |
private ICustomerService _customerService; | |
private IOrderFulfillmentService _orderFulfillmentService; | |
private const string USERNAME = "Bob"; | |
private const string PASSWORD = "Foo"; |
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 Guid PlaceOrder(Guid customerId, ShoppingCart shoppingCart) | |
{ | |
foreach (var item in shoppingCart.Items) | |
{ | |
if (item.Quantity == 0) | |
{ | |
throw new InvalidOrderException(); | |
} | |
} | |
var customer = _customerService.GetCustomer(customerId); |
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
namespace TddStore.UnitTests | |
{ | |
[TestFixture] | |
class OrderServiceTests | |
{ | |
private OrderService _orderService; | |
private IOrderDataService _orderDataService; | |
private ICustomerService _customerService; | |
private IOrderFulfillmentService _orderFulfillmentService; |
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
[Test] | |
public void WhenUserPlacesOrderWithItemThatIsInInventoryOrderFulfillmentWorkflowShouldComplete() | |
{ | |
//Arrange | |
var shoppingCart = new ShoppingCart(); | |
var itemId = Guid.NewGuid(); | |
shoppingCart.Items.Add(new ShoppingCartItem { ItemId = itemId, Quantity = 1 }); | |
var customerId = Guid.NewGuid(); | |
var customer = new Customer { Id = customerId }; | |
var orderFulfillmentSessionId = Guid.NewGuid(); |
NewerOlder