473,499 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1485
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
3721
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
2707
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
2139
by: Peter Rilling | last post by:
Does VS.NET 2005 Professional support integrated unit testing, or is that only with the team system?
72
5152
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
18942
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
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7014
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7229
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.