The following code overrides CheckResults. The purpose of the code is to examine the effects of running the production and of sending the pair of request messages sent to Tutorial.ExampleOperation. The code does the following:
Verifies that there are two new “user” entries in the Event Log. The Business Operation added a new entry each time that it processed a request message. The New variable contains the number of new user event log entries.
Verifies that the text content of the first Event Log entry is “OK”.
Verifies that the text content of the second Event Log entry is “ERROR”.
Method CheckResults(ByRef Log As %String, New As %String) As %Status
Set tSC = $$$OK
Set r = $$$AssertEquals($Get(New),2,"Should be 2 (found: "_+$Get(New)_")")
Set text = $Get(Log(1,"Text"))
Do $$$AssertEquals(text,"OK","Should be 'OK' (found: '"_text_"')")
Set text = $Get(Log(2,"Text"))
Do $$$AssertEquals(text,"ERROR","Should be 'ERROR' (found: '"_text_"')")
if 'r set tSC=..Error("Expected event log entries don't match")
The Log array contains a node corresponding to each piece of Event Log information including: Text, Type, TimeLogged, SessionId, SourceMethod, and ConfigName.
The Business Operation added entries to the Event Log using the $$$LOGINFO macro.