Doing some homework on unit testing and in all honestly i just don't get why i get this error.
i got a simple method that select all text when tab and testing if the actually textbox1 is selected. I just don't get why i'm getting a nullReferenceException at target.txtbox1_Enter(sender, e)
I'm getting really mad because this seem so easy.
any help i would appreciate it.
Private Sub txtbox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtbox1.enter
Dim txtBox As TextBox
txtBox = CType(sender, TextBox)
txtBox.SelectAll()
End Sub
<TestMethod(), DeploymentItem("frmtesting.exe")>
Public Sub txtCustomer_EnterTest()
Dim target As frmtesting_Accessor = New frmtesting_Accessor ' TODO: Initialize to an appropriate value
Dim sender As Object = Nothing ' TODO: Initialize to an appropriate value
Dim e As EventArgs = Nothing ' TODO: Initialize to an appropriate value
Dim expected As String
Dim actual As String
target.txtbox1.Text = "bob"
target.txtbox1.SelectAll()
expected = "bob"
target.txtbox1_Enter(sender, e)
actual = target.txtbox1.SelectedText
Assert.AreEqual(expected, actual, "not equal")
End Sub