Home Dashboard Directory Help
Search

Incorrect creation of unit test for public property with a private by Paulo Morgado


Status: 

Closed
 as Fixed Help for as Fixed


2
0
Sign in
to vote
Type: Bug
ID: 256387
Opened: 2/4/2007 4:24:19 PM
Access Restriction: Public
1
Workaround(s)
view
1
User(s) can reproduce this bug

Description

The creation of unit tests for a public property with a private setter doesn't generate the private accessor and generates a non compilable test.
Details
Sign in to post a comment.
Posted by Paulo Morgado on 3/2/2007 at 3:43 PM
With the mar07ctp, the generated code is:

[TestMethod()]
public void PublicAndPrivateTest()
{
    TestedClass_Shadow target = new TestedClass_Shadow(); // TODO: Initialize to an appropriate value
    object expected = null; // TODO: Initialize to an appropriate value
    object actual;
    target.PublicAndPrivate = expected;
    actual = target.PublicAndPrivate;
    Assert.AreEqual(expected, actual);
    Assert.Inconclusive("Verify the correctness of this test method.");
}

The type TestedClass_Shadow isn't genereated, though. Same as for the private accessor.
Posted by Paulo Morgado on 2/28/2007 at 1:11 PM
Not in the dec06ctp. I'll wait for the next one.
Posted by Microsoft on 2/28/2007 at 12:06 PM
We have addressed this issue in Orcas.
Posted by Paulo Morgado on 2/26/2007 at 3:35 PM
Which version are you using?

I tryed with:

Microsoft Visual Studio 2005
Version 8.0.50727.859 (vsvista.050727-8500)
Microsoft .NET Framework
Version 2.0.50727

Installed Edition: Enterprise

Microsoft Visual Basic 2005 77718-007-4000003-41831
Microsoft Visual Basic 2005

Microsoft Visual C# 2005 77718-007-4000003-41831
Microsoft Visual C# 2005

Microsoft Visual C++ 2005 77718-007-4000003-41831
Microsoft Visual C++ 2005

Microsoft Visual J# 2005 77718-007-4000003-41831
Microsoft Visual J# 2005

Microsoft Visual Studio 2005 Tools for Applications 77718-007-4000003-41831
Microsoft Visual Studio 2005 Tools for Applications

Microsoft Visual Studio Tools for Office 77718-007-4000003-41831
Microsoft Visual Studio Tools for the Microsoft Office System

Microsoft Visual Web Developer 2005 77718-007-4000003-41831
Microsoft Visual Web Developer 2005

Microsoft Web Application Projects 2005 77718-007-4000003-41831
Microsoft Web Application Projects 2005
Version 8.0.50727.859

Visual Studio 2005 Team Edition for Architects 77718-007-4000003-41831
Microsoft Visual Studio 2005 Team Edition for Software Architects

Visual Studio 2005 Team Edition for Developers 77718-007-4000003-41831
Microsoft Visual Studio 2005 Team Edition for Software Developers

Visual Studio 2005 Team Edition for Testers 77718-007-4000003-41831
Microsoft Visual Studio 2005 Team Edition for Software Testers

Visual Studio 2005 Team Explorer 77718-007-4000003-41831
Microsoft Visual Studio 2005 Team Explorer
Version 8.0.50727.762

Crystal Reports    AAC60-G0CSA4B-V7000AY
Crystal Reports for Visual Studio 2005


DXCore for Visual Studio 2.0
DXCore for Visual Studio

Extensions for Windows WF    
Windows Workflow Foundation Tools for Visual Studio

Hotfix for Microsoft Visual Studio 2005 Team Explorer - ENU (KB929470)
This Hotfix is for Microsoft Visual Studio 2005 Team Explorer - ENU.
If you later install a more recent service pack, this Hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/929470

Microsoft Visual Studio 2005 Team Explorer - ENU Service Pack 1 (KB926601)
This service pack is for Microsoft Visual Studio 2005 Team Explorer - ENU.
If you later install a more recent service pack, this service pack will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/926601

Orcas Technology Preview - .NET Framework 3.0 Development Tools 1.0
Microsoft Visual Studio Code Name Orcas Community Technology Preview - Development Tools for WinFX

Refactor! for Visual Studio 1.0
Refactor! for Visual Studio 2005.

SQL Server Analysis Services
Microsoft SQL Server Analysis Services Designer
Version 9.00.3042.00

SQL Server Integration Services
Microsoft SQL Server Integration Services Designer
Version 9.00.3042.00

SQL Server Reporting Services
Microsoft SQL Server Reporting Services Designers
Version 9.00.3042.00

DevExpress Tools
DXCore extensibility layer for Visual Studio .NET, from Developer Express, Inc. (www.devexpress.com).

and:

Microsoft Visual Studio Codename Orcas
Version 9.0.11209.0 dec06ctp
Microsoft .NET Framework
Version 2.0.50727

Installed Edition: Enterprise

Microsoft Visual Basic 2005 77718-000-0000016-00816
Microsoft Visual Basic 2005

Microsoft Visual C# 2005 77718-000-0000016-00816
Microsoft Visual C# 2005

Microsoft Visual C++ 2005 77718-000-0000016-00816
Microsoft Visual C++ 2005

Microsoft Visual Studio Tools for Office 77718-000-0000016-00816
Microsoft Visual Studio Tools for the Microsoft Office System

Microsoft Visual Web Developer 2005 77718-000-0000016-00816
Microsoft Visual Web Developer 2005

Microsoft Web Application Projects 2005 77718-000-0000016-00816
Microsoft Web Application Projects 2005
Version 9.0.11209.0

Visual Studio 2005 Team Edition for Architects 77718-000-0000016-00816
Microsoft Visual Studio 2005 Team Edition for Software Architects

Visual Studio 2005 Team Edition for Developers 77718-000-0000016-00816
Microsoft Visual Studio 2005 Team Edition for Software Developers

Visual Studio 2005 Team Edition for Testers 77718-000-0000016-00816
Microsoft Visual Studio 2005 Team Edition for Software Testers
Sign in to post a workaround.
Posted by Paulo Morgado on 2/4/2007 at 4:34 PM
Do it by hand every time the VSCodeGenAccessors.cs is generated.