Ejemplo n.º 1
0
        public void CopyToTest()
        {
            var orderItem = new OrderItem {
                Id = 2, IsMajor = true, ItemName = "pasta"
            };
            var orderItemCopy = new OrderItem();
            var copyHash      = orderItemCopy.GetHashCode();

            orderItem.CopyTo(orderItemCopy);
            var copyHashAfterCopy = orderItemCopy.GetHashCode();

            Assert.Equal(orderItem.ItemName, orderItemCopy.ItemName);
            Assert.Equal(copyHash, copyHashAfterCopy);
        }
Ejemplo n.º 2
0
 public static OrderItemDTO ToDTO(this OrderItem item) => item?.CopyTo(new OrderItemDTO());