Skip to content

Instantly share code, notes, and snippets.

Created December 7, 2019 15:21
What would you like to do?
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