Click here to Skip to main content
15,886,026 members
Articles / Programming Languages / Visual Basic

How to use the new AAA syntax in Rhino Mocks 3.5 with VB.Net

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
6 Oct 2008CPOL4 min read 25.4K   79   8  
An article on how to use the new AAA (Arrange, Act and Assert) syntax using VB.Net. And the difference between the new and the old syntax.
Imports System.Data.SqlClient

Namespace Repository
    Public Class ProductRepository
        Implements IRepository(Of Model.Product)

        ''' <summary>
        ''' Here is where you would go to the database
        ''' </summary>
        ''' <returns>A list of Products</returns>
        ''' <remarks></remarks>
        Public Function FindAll() As System.Collections.Generic.IList(Of Model.Product) Implements IRepository(Of Model.Product).FindAll
            Dim _List As New List(Of Model.Product)
            Dim _con As New SqlConnection
            Dim _com As New SqlCommand
            Dim _reader As SqlDataReader
            _con.ConnectionString = "some connectionstring"
            _con.Open()
            _com.CommandText = "Select Name from product"
            _com.Connection = _con
            _reader = _com.ExecuteReader
            While _reader.Read
                _List.Add(New Model.Product(_reader.GetString(0)))
            End While
            Return _List
        End Function
    End Class
End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) NICC
Belgium Belgium
I am a forensic technician who does some programming on the side. So I spend 75% of my time programming so that my collegues have to do less work Wink | ;-) .

I use VB.Net and C# with SQL-server as the database.
I try to use DDD and TDD techniques whenever possible.

You can find me and a lot of other professionals at LesstThanDot. Where I also host my blog.

Comments and Discussions