Created
September 7, 2019 16:15
-
-
Save IntegerMan/4f34133107c4bed3daf390f5510c5c4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ThrowIfMismatchedPublisher : IResultPublisher | |
{ | |
public Task Publish<T, TClean>(Result<T, TClean> result) | |
{ | |
if (result.Mismatched) | |
{ | |
var sb = new StringBuilder(); | |
sb.AppendLine($"{result.ExperimentName} had mismatched results: "); | |
foreach (var observation in result.MismatchedObservations) | |
{ | |
sb.AppendLine($"Value: {observation.Value}"); | |
} | |
throw new InvalidOperationException(sb.ToString()); | |
} | |
return Task.CompletedTask; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment