Skip to content

Instantly share code, notes, and snippets.

Last active May 6, 2020
What would you like to do?
DDD Example - Version 1
public class OrderTests
public void OrderItemsShouldNotBeManipulatedOutsideOrder()
var order = new Order();
order.AddOrderItem(new OrderItem(1, "Laptop"));
order.AddOrderItem(new OrderItem(2, "Keyboard"));
Assert.True(order.OrderItems.Count == 2);
var orderItem = new OrderItem(3, "Mouse");
var orderItems = (ICollection<OrderItem>)order.OrderItems;
Assert.True(order.OrderItems.Count == 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment