// DESCRIPTION: // * Returns a random number between and including the MIN_ROLL and MAX_ROLL. static void requestSeer(ISeer seerObj, uint count, ref StreamWriter sw) { sw.WriteLine("Requesting messages...\r\n"); sw.WriteLine("== {0} is now active. ==", seerObj.name()); string message = ""; Stats stats; stats.activeCount = 0; stats.inactiveCount = 0; stats.rejectCount = 0; bool lastState; while (count > 0) { message = "Lorem ipsum dolor."; lastState = seerObj.active(); seerObj.request(ref message); testStateActive(lastState, message, ref stats, ref sw); testStateChanged(lastState, seerObj, ref sw); count--; } sw.WriteLine("\r\n{0} was inactive for \"{1}\" requests.", seerObj.name(), stats.inactiveCount); sw.WriteLine("{0} was active for \"{1}\" requests and rejected " + "\"{2}\" of them.\r\n", seerObj.name(), stats.activeCount, stats.rejectCount); }
// DESCRIPTION: // * Checks if the state of the seer object changed, and records data // depending on the results. static void testStateChanged(bool lastState, ISeer seerObj, ref StreamWriter sw) { if (lastState != seerObj.active()) { if (seerObj.active()) { sw.WriteLine("\r\n== {0} is now active. ==", seerObj.name()); } else { sw.WriteLine("\r\n== {0} is now inactive. ==", seerObj.name()); } } }