Generate Test Data data using using GenFu and VB.net

Rajnilari2015
Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 308
Let us create a Entity as

Public Class Person
Public Property Id() As Integer
Get
Return m_Id
End Get
Set
m_Id = Value
End Set
End Property
Private m_Id As Integer
Public Property FirstName() As String
Get
Return m_FirstName
End Get
Set
m_FirstName = Value
End Set
End Property
Private m_FirstName As String
Public Property LastName() As String
Get
Return m_LastName
End Get
Set
m_LastName = Value
End Set
End Property
Private m_LastName As String
Public Property EmailAdress() As String
Get
Return m_EmailAdress
End Get
Set
m_EmailAdress = Value
End Set
End Property
Private m_EmailAdress As String
Public Property PhoneNumber() As String
Get
Return m_PhoneNumber
End Get
Set
m_PhoneNumber = Value
End Set
End Property
Private m_PhoneNumber As String

Public Overrides Function ToString() As String
Return "{Id}: {FirstName} {LastName} - {EmailAdress} - {PhoneNumber}"
End Function

End Class


Then add GenFu through the Nuget package manager as under

Install-Package GenFu


Finally generate the data

Public Shared Sub Main(args As [String]())
'Generate 100 random data
A.ListOf(Of Person)(100).ToList().Foreach(Function(i) Console.WriteLine(i.ToString()))
Console.ReadLine()
End Sub

Comments or Responses

Login to post response