D
Doug
I am attempting to create a unit test that can switch between calling
a method from the web service I created or calling the component that
the web service actually calls.
So in my unit test form I have a checkbox that I can use to "turn on
or off" which one I would call and I have code something like this:
if (chkUseWs.Checked == true)
{
WebReference.WebClass o = new WebReference.WebClass();
o.Method;
}
else
{
ComponentReference y = new ComponentReference();
y.Method();
}
--WebReference, WebClass and ComponentReference are all made up
names...
Anyhow, I'd like to instead just create one variable and assign it to
either the web reference or the component reference based on whether
the checkbox is checked.
I've tried creating an object variable like this:
object o = new WebReference.WebClass();
or
object o = new ComponentReference();
but that failed.
This also failed:
if (chkUseWS.Checked == true)
{
WebReference.WebClass o = new WebReference.WebClass();
}
else
{
ComponentReference o = new ComponentReference();
}
o.Method();
Is there a way to do what I'm trying to do?
a method from the web service I created or calling the component that
the web service actually calls.
So in my unit test form I have a checkbox that I can use to "turn on
or off" which one I would call and I have code something like this:
if (chkUseWs.Checked == true)
{
WebReference.WebClass o = new WebReference.WebClass();
o.Method;
}
else
{
ComponentReference y = new ComponentReference();
y.Method();
}
--WebReference, WebClass and ComponentReference are all made up
names...
Anyhow, I'd like to instead just create one variable and assign it to
either the web reference or the component reference based on whether
the checkbox is checked.
I've tried creating an object variable like this:
object o = new WebReference.WebClass();
or
object o = new ComponentReference();
but that failed.
This also failed:
if (chkUseWS.Checked == true)
{
WebReference.WebClass o = new WebReference.WebClass();
}
else
{
ComponentReference o = new ComponentReference();
}
o.Method();
Is there a way to do what I'm trying to do?