Created
November 2, 2017 10:04
-
-
Save Hameds/96b5cb6eef446b5992f98fd101eec412 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
| [Test] | |
| public void WhenUserPlacesACorrectOrderThenAnOrderNumberShouldBeReturned() | |
| { | |
| //Arrange | |
| var shoppingCart = new ShoppingCart(); | |
| shoppingCart.Items.Add(new ShoppingCartItem { ItemId = Guid.NewGuid(), Quantity = 1 }); | |
| var customerId = Guid.NewGuid(); | |
| var expectedOrderId = Guid.NewGuid(); | |
| var orderDataService = Mock.Create(); | |
| Mock.Arrange(() => orderDataService.Save(Arg.IsAny())) | |
| .Returns(expectedOrderId) | |
| .OccursOnce(); | |
| OrderService orderService = new OrderService(orderDataService); | |
| //Act | |
| var result = orderService.PlaceOrder(customerId, shoppingCart); | |
| //Assert | |
| Assert.AreEqual(expectedOrderId, result); | |
| Mock.Assert(orderDataService); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment