I tried this on VS2003 and it looks like a limitaion of the VB compiler to let you do this. Objects are passed into this function and then cast further down the chain. Due to this limitaion I know of no way around this other than using C# for these kind of tests and using VB for others (far from ideal I know). I can confirm it works ok on VS2005 (again not much to you also) for C# and VB. If anyone does have a wrok around for this then please share.
Andy
On 2/8/06, Andrew Stopford <[EMAIL PROTECTED]> wrote:
Hi Phil,Are you running this on VS2003? It works ok on 2005.I guess the issue is VB, you will need to make the input values constantsAndy
On 2/8/06, [EMAIL PROTECTED] < [EMAIL PROTECTED] > wrote:
Hi,
Thanks for that Andy but the same problem persists.. did you actually get this to run for you?
When I put this code in the
<RowTest(), Row(1000, 10, 100.0)>
portion of code underlines the numbers in blue and the hover over information states that
' Conversion from 'Double' to ' System.Object' cannot occur in a constant _expression_ '
Any ideas?
Phil
--- On Wed 02/08, Andrew Stopford < [EMAIL PROTECTED] > wrote:
From: Andrew Stopford [mailto: [EMAIL PROTECTED]]
To: [EMAIL PROTECTED]
Date: Wed, 8 Feb 2006 15:43:54 +0000
Subject: MbUnit Re: VB.NET
<div>Hi,</div>
<div></div>
<div>The code you need is</div>
<div></div>
<div><font color="#0000ff" size="2">
<p>Imports</p></font><font size="2"> MbUnit.Framework</font><font color="#0000ff" size="2">
<p>Imports</p></font><font size="2"> MbUnit.Core.Framework
<p><TestFixture()> _</p></font><font color="#0000ff" size="2">
<p>Public</p></font><font size="2"> </font><font color="#0000ff" size="2">Class</font><font size="2"> Class1
<p><strong><RowTest(), Row(1000, 10, 100.0)> _</strong></p>
<p></p></font><strong><font color="#0000ff" size="2">Public</font><font size="2"> </font><font color="#0000ff" size="2">Sub</font><font size="2"> DivTest(</font><font color="#0000ff" size="2">ByVal</font><font size="2"> numerator
</font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Double</font><font size="2">, </font><font color="#0000ff" size="2">ByVal</font><font size="2"> denominator </font><font color="#0000ff" size="2">
As</font><font size="2"> </font><font color="#0000ff" size="2">Double</font><font size="2">, </font><font color="#0000ff" size="2">ByVal</font><font size="2"> result </font><font color="#0000ff" size="2">As</font><font size="2">
</font><font color="#0000ff" size="2">Double</font></strong><font size="2"><strong>)</strong>
<p><strong>Assert.AreEqual(result, numerator / denominator, 0.00001)</strong></p>
<p></p></font><strong><font color="#0000ff" size="2">End</font><font size="2"> </font></strong><font color="#0000ff" size="2"><strong>Sub</strong>
<p>End</p></font><font size="2"> </font><font color="#0000ff" size="2">Class</font></div>
<div>HTH</div>
<div></div>
<div>Andy<br></div>
<div><span class="gmail_quote">On 2/8/06, <b class="gmail_sendername">Phil</b> <<a href="" href="mailto:[EMAIL PROTECTED]" target="_blank"> [EMAIL PROTECTED]">[EMAIL PROTECTED]</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>Hi All, I'm new to MBUnit and would really appreciate it if someone<br>could provide me with a bit of help. I can use rowtest in c# like:
<br><br>[RowTest]<br>[Row(1000,10, 100.0000)]<br>[Row(-1000,10,-100.0000)]<br>[Row(1000,7,142.85715)]<br>[Row(1000,0.00001,100000000)]<br>[Row(4195835,3145729,1.3338196)]<br>public void DivTest(double numerator, double denominator, double
<br>result)<br>{<br> Assert.AreEqual(result, numerator / denominator, 0.00001 );<br>}<br><br>and it runs no problem, however I want to convert this to <a href="" href="http://vb.net/" target="_blank"> http://VB.NET">VB.NET</a>, i<br>have tried numerous ways but cant get it.
<br><br><RowTest, Row(1000,10, 100.0000)> public sub DivTest(byval numerator as<br>double, byval denominator as double, byval result as double)<br>{<br> Assert.AreEqual(result, numerator / denominator, 0.00001
);<br>}<br><br>complains about converting the numbers in the row() attribute to<br>objects and<br><br><br><RowTest()> _<br><Row(1000,10, 100.0000)> _<br>public sub DivTest(byval numerator as double, byval denominator as
<br>double, byval result as double)<br>{<br> Assert.AreEqual(result, numerator / denominator, 0.00001 );<br>}<br><br>complains about the line continuation, please could someone point out<br>where I'm being stupid, thanks.
<br><br>Phil<br><br></blockquote></div><br>
<p>
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
