nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #02546
[Bug 498690] Re: Assert.That() doesn't like properties with scoped setters
I added Assert.ByVal methods equivalent to Assert.That, but without the
offending overload. Note that there is no equivalent in the
AssertionHelper syntax (Expect) so you have to use Assert.ByVal if the
problem applies.
** Changed in: nunitv2
Status: Triaged => Fix Committed
--
You received this bug notification because you are a member of NUnit
Core Developers, which is the registrant for NUnit Framework.
https://bugs.launchpad.net/bugs/498690
Title:
Assert.That() doesn't like properties with scoped setters
Status in NUnit Test Framework:
Triaged
Status in NUnit V2 Test Framework:
Fix Committed
Bug description:
Public Class SomeClass
Public Property BrokenProp() As String
Get
Return String.Empty
End Get
Private Set(ByVal value As String)
End Set
End Property
End Class
<TestFixture()> Public Class clsTestTask
<Test()> Public Sub TestXyz()
Dim obj As New SomeClass()
Expect(obj.BrokenProp, EqualTo(String.Empty))
End Sub
End Class
The above code produces a compiler error:
Error 1 'Set' accessor of property 'BrokenProp' is not accessible.
If the scoping wasn't applied to the setter on the property or the property
was ReadOnly, the compile error goes away.
This is a .NET 2.0 assembly, compiled with the Visual Studio 2008 SP1.
NUnit 2.4.7 and prior did not experience this issue.
BTW, I've also started a Google Group posting for this issue:
http://groups.google.com/group/nunit-discuss/browse_thread/thread/edb56db3d3e60195
[From SF:2792355]
SF Comment:
More info... the equivalent scoped setter in C# does not have this problem.
It arises solely with VB.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nunit-3.0/+bug/498690/+subscriptions