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.Check ed == true)
{
WebReference.We bClass o = new WebReference.We bClass();
o.Method;
}
else
{
ComponentRefere nce y = new ComponentRefere nce();
y.Method();
}
--WebReference, WebClass and ComponentRefere nce 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.We bClass();
or
object o = new ComponentRefere nce();
but that failed.
This also failed:
if (chkUseWS.Check ed == true)
{
WebReference.We bClass o = new WebReference.We bClass();
}
else
{
ComponentRefere nce o = new ComponentRefere nce();
}
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.Check ed == true)
{
WebReference.We bClass o = new WebReference.We bClass();
o.Method;
}
else
{
ComponentRefere nce y = new ComponentRefere nce();
y.Method();
}
--WebReference, WebClass and ComponentRefere nce 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.We bClass();
or
object o = new ComponentRefere nce();
but that failed.
This also failed:
if (chkUseWS.Check ed == true)
{
WebReference.We bClass o = new WebReference.We bClass();
}
else
{
ComponentRefere nce o = new ComponentRefere nce();
}
o.Method();
Is there a way to do what I'm trying to do?
Comment