473,320 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Unit testing

Please can you show me how to unit test the following class...

Friend Delegate Sub Delegate1()

Friend Class Class1

Private m_Delegate1 As Delegate1

Friend WriteOnly Property Delegate1() As Delegate1
Set(ByVal value As Delegate1)
Me.m_Delegate1 = value
End Set
End Property

Friend Sub Sub1()
Me.m_Delegate1.Invoke()
End Sub

End Class

I want my test to look something like this...

Public Sub Test()

Dim target As Object = Class1Accessor.CreatePrivate

Dim val As Delegate1Accessor = New Delegate1Accessor(AddressOf MySub)

Dim accessor As Class1Accessor = New Class1Accessor(target)

accessor.Delegate1 = val
accessor.Sub1()

End Sub

Public Sub MySub()
Stop
End Sub
Jun 19 '06 #1
4 1477
Hi Richard,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jun 20 '06 #2
Hi Richard,

I'm not quite sure what do you mean by Class1Accessor.CreatePrivate? Could
you explain it with a little more details?

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 20 '06 #3
Hi Kevin.

Class1Accessor.CreatePrivate creates an object from the private class
"Class1".

ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VSENT.v80.en/dv_vsetlt01/html/f6cc7fc2-c43c-4b0c-ba4e-60755cc39e28.htm
explains how to create unit tests for private members.

"Kevin Yu [MSFT]" wrote:
Hi Richard,

I'm not quite sure what do you mean by Class1Accessor.CreatePrivate? Could
you explain it with a little more details?

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 20 '06 #4
Hi Richard,

Sorry for the late response, but your code seems to be fine. I used the
code generator to generate test code. It looks like the following which
seems to be the same as the code you have provided.

<DeploymentItem("WindowsApplication85.exe"), _
TestMethod()> _
Public Sub Delegate1Test()
Dim target As Object =
WindowsApplication85_Class1Accessor.CreatePrivate

Dim val As WindowsApplication85_Delegate1Accessor = New
WindowsApplication85_Delegate1Accessor(AddressOf MySub) 'TODO: Assign to an
appropriate value for the property

Dim accessor As WindowsApplication85_Class1Accessor = New
WindowsApplication85_Class1Accessor(target)

accessor.Delegate1 = val

Assert.Inconclusive("Write-only properties cannot be verified.")
End Sub

Are you testing the delegate? Do you have any concerns on this? Please feel
free to let me know.

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 22 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Hugh Cowan | last post by:
Hello, I don't program full-time (anymore), but I do try and stay on-top of the latest technologies and like most are always trying to upgrade my skills and remain current (as much as is...
14
by: | last post by:
Hi! I'm looking for unit-testing tools for .NET. Somthing like Java has --> http://www.junit.org regards, gicio
4
by: Peter Rilling | last post by:
Does VS.NET 2005 Professional support integrated unit testing, or is that only with the team system?
72
by: Jacob | last post by:
I have compiled a set og unit testing recommendations based on my own experience on the concept. Feedback and suggestions for improvements are appreciated: ...
4
by: Dat AU DUONG | last post by:
Hi, I am new to Unit testing, could you tell me where I could find information (hopefully step by step) and what is the benefit of unit testing. I am a sole developer in a company, therefore I...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.