A
Andrew Bingham
A feature I want to test calls a BackgroundWorker.
How do I use Visual Studio Unit Test to do this?
I can see why the callback method DoWork_Completed (in the sample below) is
NOT reached during when running Test1. Is there a way of achieving this?
<TestMethod()> Public Sub Test1()
Dim txn As MyTransaction = New myTransaction
txn.DoWork(AddressOf Me.DoWork_Completed, someParameters)
End Sub
Private Sub DoWork_Completed(ByVal results as DataSet)
Assert.AreEqual(results.SourceInfo.Rows(0).Item(0),"X")
End Sub
(BTW My UI application invokes a BackgroundWorker when making a call to a
SQL Server stored procedure to get data for a user to view. Using a
BackgroundWorker allows the user to, for example, cancel viewing the data and
do some other UI task. So this seems a common-ish thing to want to do and
test)
How do I use Visual Studio Unit Test to do this?
I can see why the callback method DoWork_Completed (in the sample below) is
NOT reached during when running Test1. Is there a way of achieving this?
<TestMethod()> Public Sub Test1()
Dim txn As MyTransaction = New myTransaction
txn.DoWork(AddressOf Me.DoWork_Completed, someParameters)
End Sub
Private Sub DoWork_Completed(ByVal results as DataSet)
Assert.AreEqual(results.SourceInfo.Rows(0).Item(0),"X")
End Sub
(BTW My UI application invokes a BackgroundWorker when making a call to a
SQL Server stored procedure to get data for a user to view. Using a
BackgroundWorker allows the user to, for example, cancel viewing the data and
do some other UI task. So this seems a common-ish thing to want to do and
test)