Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tobias Morf 80 posts 183 karma points
    Oct 14, 2011 @ 13:48
    Tobias Morf
    0

    How can I create Mock Elements of type TeaCommerce.Data.Order?

    Needed for unit testing.

    Thx Tobias

  • Anders Burla 2560 posts 8256 karma points
    Oct 14, 2011 @ 14:04
    Anders Burla
    0

    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

  • Tobias Morf 80 posts 183 karma points
    Oct 14, 2011 @ 16:28
    Tobias Morf
    0

    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.

     

  • Anders Burla 2560 posts 8256 karma points
    Oct 14, 2011 @ 16:39
    Anders Burla
    1

    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 :)

  • Tobias Morf 80 posts 183 karma points
    Oct 14, 2011 @ 16:46
    Tobias Morf
    0

    How can I "simulate" the umbraco environment (or better teacommerce) within an unit test project?

    Thx for your help

  • Anders Burla 2560 posts 8256 karma points
    Oct 14, 2011 @ 22:43
    Anders Burla
    0

    Hi Tobias

    I dont know that - I think that is more an umbraco question or a google question :)

  • Tobias Morf 80 posts 183 karma points
    Oct 20, 2011 @ 14:35
    Tobias Morf
    0

    Yes, you're right. Thx for your help.

  • Anders Burla 2560 posts 8256 karma points
    Oct 20, 2011 @ 14:42
    Anders Burla
    0

    Your welcome - hope you find your answer

Please Sign in or register to post replies

Write your reply to:

Draft