Last active
May 6, 2020 21:50
-
-
Save ankitvijay/8b9722a42890b934d1f8695a73db5c89 to your computer and use it in GitHub Desktop.
DDD Example - Version 1
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 class OrderTests | |
{ | |
[Fact] | |
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; | |
orderItems.Add(orderItem); | |
Assert.True(order.OrderItems.Count == 2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment