473,563 Members | 2,668 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 Delegate1Access or = New Delegate1Access or(AddressOf MySub)

Dim accessor As Class1Accessor = New Class1Accessor( target)

accessor.Delega te1 = val
accessor.Sub1()

End Sub

Public Sub MySub()
Stop
End Sub
Jun 19 '06 #1
4 1495
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.ht m
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 ("WindowsApplic ation85.exe"), _
TestMethod()> _
Public Sub Delegate1Test()
Dim target As Object =
WindowsApplicat ion85_Class1Acc essor.CreatePri vate

Dim val As WindowsApplicat ion85_Delegate1 Accessor = New
WindowsApplicat ion85_Delegate1 Accessor(Addres sOf MySub) 'TODO: Assign to an
appropriate value for the property

Dim accessor As WindowsApplicat ion85_Class1Acc essor = New
WindowsApplicat ion85_Class1Acc essor(target)

accessor.Delega te1 = val

Assert.Inconclu sive("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
3726
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 possible). Most of my programming these days involves using PHP for creating script files for automating tasks and procedures (locally), and also for...
14
2722
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
2154
by: Peter Rilling | last post by:
Does VS.NET 2005 Professional support integrated unit testing, or is that only with the team system?
72
5187
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: http://geosoft.no/development/unittesting.html Thanks.
4
18952
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 don't get expose to much of this technology. Thanks in advance. Regards Dat.
0
7583
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7885
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7948
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6250
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
923
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.