Skip to content

Instantly share code, notes, and snippets.

@Hameds
Created November 2, 2017 10:35
Show Gist options
  • Save Hameds/c7ef02374018b2160a050a1c92b4af2e to your computer and use it in GitHub Desktop.
Save Hameds/c7ef02374018b2160a050a1c92b4af2e to your computer and use it in GitHub Desktop.
[Test]
public void WhenAValidCustomerPlacesAValidOrderAnOrderShouldBePlaced()
{
//Arrange
var shoppingCart = new ShoppingCart();
shoppingCart.Items.Add(new ShoppingCartItem { ItemId = Guid.NewGuid(), Quantity = 1 });
var customerId = Guid.NewGuid();
var customerToReturn = new Customer { Id = customerId, FirstName = "Fred", LastName = "Flinstone" };
Mock.Arrange(() => _customerService.GetCustomer(customerId))
.Returns(customerToReturn)
.OccursOnce();
//Act
_orderService.PlaceOrder(customerId, shoppingCart);
//Assert
Mock.Assert(_customerService);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment