Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created December 7, 2019 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IntegerMan/a9977e08f4803f3baa00cef9f36e8d9c to your computer and use it in GitHub Desktop.
Save IntegerMan/a9977e08f4803f3baa00cef9f36e8d9c to your computer and use it in GitHub Desktop.
public async Task<AnalysisResult> AnalyzeAsync(Resume resume) {
var oldAnalyzer = new LegacyAnalyzer();
var newAnalyzer = new ExperimentalAnalyzer();
return await Scientist.ScienceAsync<AnalysisResult>(
"Simple Async Experiment",
experiment =>
{
// This analyzer's result will returned
experiment.Use(() => oldAnalyzer.AnalyzeAsync(resume));
// This will be run, but its value will not be returned
experiment.Try(() => newAnalyzer.AnalyzeAsync(resume));
// Tell Scientist how to compare two results
experiment.Compare((x, y) => x.Score == y.Score);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment