UtilProfillingTestExecutionTimeAsync Method
Asynchronously tests the execution of a Action and measures the elapsed time.
Namespace: DevCase.Core.Diagnostics.ProfillingAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
No code example is currently available or this language may not be supported.
- action Action
-
The Action to invoke.
TaskTestExecutionInfo
An async
TaskTResult object that contains the result of the test.
This is a code example.
No code example is currently available or this language may not be supported.
Sub Test()
Dim taskTestTime As Task(Of TestExecutionInfo) =
TestTimeAsync(Sub()
For x As Integer = 0 To 2500
Console.WriteLine(x)
Next x
End Sub)
taskTestTime.ContinueWith(Sub() Me.ShowTestExecutionInfo(taskTestTime.Result))
End Sub
Private Sub ShowTestExecutionInfo(ByVal teInfo As TestExecutionInfo)
Dim sb As New Global.System.Text.StringBuilder
Select Case teInfo.Success
Case True
With sb ' Set an information message.
.AppendLine(String.Format("Method Name: {0}", teInfo.Method.Name))
.AppendLine()
.AppendLine(String.Format("Elapsed Time: {0}", teInfo.Elapsed.ToString("hh\:mm\:ss\:fff")))
End With
MessageBox.Show(sb.ToString(), "Code Execution Measurer", MessageBoxButtons.OK, MessageBoxIcon.Information)
Case Else
With sb ' Set an error message.
.AppendLine("Exception occurred during code execution measuring.")
.AppendLine()
.AppendLine(String.Format("Method Name: {0}", teInfo.Method.Name))
.AppendLine()
.AppendLine(String.Format("Exception Type: {0}", teInfo.Exception.GetType().Name))
.AppendLine()
.AppendLine("Exception Message:")
.AppendLine(teInfo.Exception.Message)
.AppendLine()
.AppendLine("Exception Stack Trace:")
.AppendLine(teInfo.Exception.StackTrace)
End With
MessageBox.Show(sb.ToString(), "Code Execution Measurer", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Select
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.