Ask a questionAsk a question
 

AnswerHow to unit test Commerce Server 2009?

  • Tuesday, November 03, 2009 2:10 PMSamDesh Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I am trying to write unit tests for Commerce server 2009.
    The unit tests are failing and it looks like it has to do with ServiceConfiguration, which cannot be defined in the app.config section of unit test project.

    My question is how do we load and initialize the ServiceConfiguration for unit testing?

Answers

All Replies

  • Tuesday, November 03, 2009 3:15 PMChuck M Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    • Marked As Answer bySamDesh Wednesday, November 04, 2009 3:06 PM
    •  
  • Tuesday, November 03, 2009 9:14 PMLewisBenge Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Sam,

    You could also using a Mocking framework for testing Commerce Foundation, the underlying principals are based on WCF so possibly TypeMock - who provide Mock assemblies for WCF would be suitable in these instances? http://learn.typemock.com/wcf-page

    Thanks,
    Lewis
    Follow Me on Twitter: @LewisBenge Or check out my blog: http://www.geekswithblogs.com/pointtoshare/
  • Wednesday, November 04, 2009 3:05 PMSamDesh Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Chuck,

    The link you provided was very helpful.
    As I was trying to do a unit test, I had to complete the following additional steps:
    1. Unit test creates TestResult folder and expects the ChannelConfiguration.config and Metadatadefinitions.xml in the out folder. Use DeploymentItem("ChannelConfiguration") and DeploymentItem("Metadatadefinitions.xml") to get these files copied over.
    2. Compare the ChannelConfiguration.config provided in the console application against yours. There are few other changes in the .config file in addition to the useSharedCommerceContexts flag.