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); }
public static OrderItemDTO ToDTO(this OrderItem item) => item?.CopyTo(new OrderItemDTO());