Closed danielepo closed 7 years ago
If you have something that the access will change from global/session for comparison, then I think Scientist can help. If your app is using session, then you might be storing something like the current user in there. This is an example of a refactor that could be made to hook Scientist up to say load the User from the database by name instead of relying on session state.
IUser GetUser(string username) {
return Scientist.Science<bool>(nameof(GetUser), experiment =>
{
experiment.Use(() => (IUser)Session["CurrentUser"]);
experiment.Try(() => LoadUserFromDb(username));
});
}
Note that to gain the full advantage of Scientist things like tracking results, custom comparisons, enabling observations, etc., there is additional wiring that can be found in the README.md.
As you may have guessed I work in a really ugly codebase :-)
Is there a way to verify the access to global variables during the execution an experiment?