Last active
December 26, 2015 10:59
-
-
Save JamesBender/7140449 to your computer and use it in GitHub Desktop.
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(); | |
Mock.Arrange(() => _customerService.GetCustomer(customerId)).Returns(customer).OccursOnce(); | |
Mock.Arrange(() => _orderFulfillmentService.OpenSession(Arg.IsAny<string>(), Arg.IsAny<string>())) | |
.Returns(orderFulfillmentSessionId) | |
.InOrder(); | |
Mock.Arrange(() => _orderFulfillmentService.IsInInventory(orderFulfillmentSessionId, itemId, 1)) | |
.Returns(true) | |
.InOrder(); | |
Mock.Arrange(() => | |
_orderFulfillmentService. | |
PlaceOrder(orderFulfillmentSessionId, Arg.IsAny<IDictionary<Guid, int>>(), Arg.IsAny<string>())) | |
.Returns(true) | |
.InOrder(); | |
Mock.Arrange(() => _orderFulfillmentService.CloseSession(orderFulfillmentSessionId)) | |
.InOrder(); | |
//Act | |
_orderService.PlaceOrder(customerId, shoppingCart); | |
//Assert | |
Mock.Assert(_orderFulfillmentService); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment