At the moment we have made our data objects constructors internal as it makes the API for the developers much more simple and easy to understand. The way the .NET API is used is that you hook into different webshop events and we send you the objects as arguments for the events. Then you can manipulate the object and save it if needed - but you dont need to know how to make an order object, orderline object, price object etc.
But I can see that it could be a problem for you that we have closed the API in that way. Could you try and describe your case and how you need the unit testing to work and what to test?
Ahh I see. You could make the unit test take a specific order - Order.GetOrder(orderId) and then use that to generate the pdf - If you would have to create the Order object from the constructor ( which is internal at the time ) you would have to do a LOT of stuff to fill the order object correctly - like VAT, prices, properties, orderlines etc..
Mock Data
How can I create Mock Elements of type TeaCommerce.Data.Order?
Needed for unit testing.
Thx Tobias
Hi Tobias
At the moment we have made our data objects constructors internal as it makes the API for the developers much more simple and easy to understand. The way the .NET API is used is that you hook into different webshop events and we send you the objects as arguments for the events. Then you can manipulate the object and save it if needed - but you dont need to know how to make an order object, orderline object, price object etc.
But I can see that it could be a problem for you that we have closed the API in that way. Could you try and describe your case and how you need the unit testing to work and what to test?
/Anders
We are developing an automatic generated pdf for our invoice.
The event we hook in is WebshopEvents.BeforeOrderConfirmationMailSend.
The constructor of our pdf creator has the TeaCommerce.Data.Order as an argument.
So it would be very easy to test it local with an unit test.
Ahh I see. You could make the unit test take a specific order - Order.GetOrder(orderId) and then use that to generate the pdf - If you would have to create the Order object from the constructor ( which is internal at the time ) you would have to do a LOT of stuff to fill the order object correctly - like VAT, prices, properties, orderlines etc..
Think this is a simple solution :)
How can I "simulate" the umbraco environment (or better teacommerce) within an unit test project?
Thx for your help
Hi Tobias
I dont know that - I think that is more an umbraco question or a google question :)
Yes, you're right. Thx for your help.
Your welcome - hope you find your answer
is working on a reply...