Visual Basic.Net and NUnit Gotcha

I like the NUnit 2.4 Constraint based syntax. So In my new role I am having to implement Unit Testing so I decided on going with NUnit to begin with despite my preference for MbUnit. But once I got started writing my tests, I discover Is is a keyword in VB (I'm more of a C# person, but hey I'm no language bigot). I kinda freak out a little. Did I do something wrong? Forget to add something? Google a bit and still no joy. Then I remember the code examples installed with NUnit and have a look and what do you know? Is is now Iz in VB. Not exactly as clear as Is but you gotta do what you gotta do. So now in VB a Unit Test looks like this

   1:  Imports NUnit.Framework
   2:  Imports NUnit.Framework.SyntaxHelpers
   3:  <TestFixture()> _
   4:  Public Class MyVIsualBasicSampleTests
   5:   
   6:      <Test()> _
   7:      Public Sub TestBlankForSyntax()
   8:          Assert.That(something.IsSomething(), Iz.False)
   9:      End Sub
  10:   
  11:      <Test()> _
  12:      Public Sub AnotherSampleTestForSomethingElse()
  13:          Assert.That(something.IsSomethingElse(), Iz.True)
  14:      End Sub
  15:   
  16:  End Class

And there you go.

3 Comments

Comments have been disabled for this content.