|
Home > Archive > Commerce Server General > September 2006 > Pipeline execution via VSTS unit test
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Pipeline execution via VSTS unit test
|
|
| Thomas 2006-09-16, 7:28 pm |
| I'm having an awful time trying to get a simple basket pipeline to execute
properly. The debugging tools are difficult if not unsuable. Here's what I'd
like if someone is willing to provide it: A unit test for VSTS that will execute
the pipeline. Here's what I have:
OrderSiteAgent orderSiteAgent = new OrderSiteAgent("MySite");
OrderManagementContext orderMgtContext =
OrderManagementContext.Create(orderSiteAgent);
Basket basket = OrderContext.Current.GetBasket(Guid.NewGuid(), "default");
OrderAddresses address = new OrderAddress("Home", Guid.NewGuid());
basket.Addresses.Add(address);
OrderForm orderForm = new OrderForm();
//This catalog was created with variants although there are none on this
particular product.
//Available inventory is 10.
LineItem item = new LineItem("MyCatalog", "A ProductId", null, 2);
orderForm.LineItems.Add(item);
basket.OrderForm.Add(orderForm);
basket.Save();
PipelineInfo pipeline = new Pipeline("basket");
PipelineExecutionResult result = basket.RunPipeline(pipeline);
-----------------
Other Config stuff:
I have the test environment set to copy the OrderObjectMappings.xml and
OrderPipelineMappings.xml files into the bin folder on build.
My App.Config for my Test project has
<pipelines loggingEnabled="true"
logPath="C:\....\log"
<pipeline
name="basket"
path="C:\...\basket.pcf"
transacted="false"
type="OrderPipeline"
loggingEnabled="true" />
....
</pipelines>
-----------------
From this I get a System.NullReferenceException: Object reference not set to an
instance of an object. This is CS 101 stuff that out of the box I cannot seem to
get working nor can I easily determine the cause of the problem.
Thomas
| |
| WenJun Zhang[msft] 2006-09-18, 1:21 pm |
| Hi Thomas,
We need gather more detailed error info of the problem first.
Have you tried debugging into the app and checked the exception is thrown
from which link of the code? Could you please post the call stack trace
here when the exception gets caught?
Thanks & Have a nice day.
Sincerely,
WenJun Zhang
Microsoft Online Community Support
========================================
==========
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at:
http://msdn.microsoft.com/subscript...t/default.aspx.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
| |
| David Lott [MSFT] 2006-09-19, 7:20 pm |
| Hi Thomas,
Generally you need to run pipelines from within an ASP.NET application, and
it doesn't sound like you're doing that. This sets up a lot of things for
you like the CommerceContext, which may be causing your null reference
exception.
Fortunately, Nihit has a blog post about running pipelines in a console
application:
http://blogs.msdn.com/nihitk/archiv...nesFromAConsole
App.aspx Take a look over there and let us know if you're still having
problems.
Thanks,
David Lott
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2006 Microsoft Corporation. All rights
reserved.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--------------------
Reply-To: "Thomas" <thomas@newsgroup.nospam>
From: "Thomas" <thomas@newsgroup.nospam>
Subject: Pipeline execution via VSTS unit test
Date: Fri, 15 Sep 2006 19:19:54 -0700
Newsgroups: microsoft.public.commerceserver.general
I'm having an awful time trying to get a simple basket pipeline to execute
properly. The debugging tools are difficult if not unsuable. Here's what
I'd
like if someone is willing to provide it: A unit test for VSTS that will
execute
the pipeline. Here's what I have:
OrderSiteAgent orderSiteAgent = new OrderSiteAgent("MySite");
OrderManagementContext orderMgtContext =
OrderManagementContext.Create(orderSiteAgent);
Basket basket = OrderContext.Current.GetBasket(Guid.NewGuid(), "default");
OrderAddresses address = new OrderAddress("Home", Guid.NewGuid());
basket.Addresses.Add(address);
OrderForm orderForm = new OrderForm();
//This catalog was created with variants although there are none on this
particular product.
//Available inventory is 10.
LineItem item = new LineItem("MyCatalog", "A ProductId", null, 2);
orderForm.LineItems.Add(item);
basket.OrderForm.Add(orderForm);
basket.Save();
PipelineInfo pipeline = new Pipeline("basket");
PipelineExecutionResult result = basket.RunPipeline(pipeline);
-----------------
Other Config stuff:
I have the test environment set to copy the OrderObjectMappings.xml and
OrderPipelineMappings.xml files into the bin folder on build.
My App.Config for my Test project has
<pipelines loggingEnabled="true"
logPath="C:\....\log"
<pipeline
name="basket"
path="C:\...\basket.pcf"
transacted="false"
type="OrderPipeline"
loggingEnabled="true" />
...
</pipelines>
-----------------
From this I get a System.NullReferenceException: Object reference not set
to an
instance of an object. This is CS 101 stuff that out of the box I cannot
seem to
get working nor can I easily determine the cause of the problem.
Thomas
| |
|
| Watch the word wrap on that link David posted - it should include a .aspx
extension. I used this link a few weeks ago to create a number of Pipeline
Unit Tests and was pleased with the results. I was able to turn it around
and use it successfully in VSTS unit tests. Note that there is a
downloadable sample project buried on that page that is the real value of
the link. Search for the text "CS2007_PipelineConsoleApp.zip" in the page.
Mark
"David Lott [MSFT]" <dlott@online.microsoft.com> wrote in message
news:r6Qf4rC3GHA.396@TK2MSFTNGXA01.phx.gbl...
> Hi Thomas,
>
> Generally you need to run pipelines from within an ASP.NET application,
> and
> it doesn't sound like you're doing that. This sets up a lot of things for
> you like the CommerceContext, which may be causing your null reference
> exception.
>
> Fortunately, Nihit has a blog post about running pipelines in a console
> application:
> http://blogs.msdn.com/nihitk/archiv...nesFromAConsole
> App.aspx Take a look over there and let us know if you're still having
> problems.
>
>
> Thanks,
> David Lott
>
> Microsoft
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> You assume all risk for your use. © 2006 Microsoft Corporation. All rights
> reserved.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> --------------------
> Reply-To: "Thomas" <thomas@newsgroup.nospam>
> From: "Thomas" <thomas@newsgroup.nospam>
> Subject: Pipeline execution via VSTS unit test
> Date: Fri, 15 Sep 2006 19:19:54 -0700
> Newsgroups: microsoft.public.commerceserver.general
>
> I'm having an awful time trying to get a simple basket pipeline to execute
> properly. The debugging tools are difficult if not unsuable. Here's what
> I'd
> like if someone is willing to provide it: A unit test for VSTS that will
> execute
> the pipeline. Here's what I have:
>
> OrderSiteAgent orderSiteAgent = new OrderSiteAgent("MySite");
> OrderManagementContext orderMgtContext =
> OrderManagementContext.Create(orderSiteAgent);
>
> Basket basket = OrderContext.Current.GetBasket(Guid.NewGuid(), "default");
>
> OrderAddresses address = new OrderAddress("Home", Guid.NewGuid());
> basket.Addresses.Add(address);
>
> OrderForm orderForm = new OrderForm();
>
> //This catalog was created with variants although there are none on this
> particular product.
> //Available inventory is 10.
> LineItem item = new LineItem("MyCatalog", "A ProductId", null, 2);
>
> orderForm.LineItems.Add(item);
> basket.OrderForm.Add(orderForm);
>
> basket.Save();
>
> PipelineInfo pipeline = new Pipeline("basket");
> PipelineExecutionResult result = basket.RunPipeline(pipeline);
>
> -----------------
>
> Other Config stuff:
>
> I have the test environment set to copy the OrderObjectMappings.xml and
> OrderPipelineMappings.xml files into the bin folder on build.
>
> My App.Config for my Test project has
> <pipelines loggingEnabled="true"
> logPath="C:\....\log"
> <pipeline
> name="basket"
> path="C:\...\basket.pcf"
> transacted="false"
> type="OrderPipeline"
> loggingEnabled="true" />
> ..
> </pipelines>
>
> -----------------
> From this I get a System.NullReferenceException: Object reference not set
> to an
> instance of an object. This is CS 101 stuff that out of the box I cannot
> seem to
> get working nor can I easily determine the cause of the problem.
>
>
> Thomas
>
>
>
>
>
|
|
|
|
|