Validating program behavior using the built-in mechanism
Let's go back to our example app. Since we've made many changes, let's synchronize the code and make sure that we are on the same page. The following is the current version of ApplicationContext
:
entity ApplicationContext { field emailServiceEnabled: Bool; field successCount: Int = 0; field errorCount: Int = 0; field leftToSend: Int = 10; field user: User; }
The following code shows the sendEmail
and doSend
functions that we currently have:
function sendEmail(ref context: ApplicationContext): ApplicationContext { let sent = doSend(context); let { successCount = suc, errorCount = error, leftToSend = left } = context.{ successCount, errorCount, leftToSend }; ...