← Back to team overview

nunit-core team mailing list archive

[Bug 498690] Re: Assert.That() doesn't like properties with scoped setters

 

** Branch linked: lp:nunit-3.0

-- 
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:
  Fix Committed
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