I've got some code which converts from type X to Z on a web service. The X is from our database and we convert it to Z using the below code to send to the customer's required format . I've simplified it to keep it really basic.
So, let me give you my unit test:
OrderReleased orderReleased = new OrderReleased(); orderReleased.MessageId = 1234; orderReleased.OrderId = "123"; // PS: Convert data from our type to customer's data-type var orderReleased = Converter.Transform(orderReleased); Assert.AreEqual(orderReleased.MessageId, orderReleasedReflex.message.msgId); Assert.AreEqual(orderReleased.OrderId, orderReleasedReflex.message.orderId);
Though, there are many fields in these classes and many classes to test. Is there more of an elegent way of performing these test to ensure the data is been copied accross? And ensuring if any new fields are added that the test fails? Thank you.