// protected methods protected override void AssertOperation(JsonDrivenTest test) { var actualException = test._actualException(); if (test._expectedException() == null) { if (actualException != null) { if (!(actualException is OperationCanceledException)) { Console.WriteLine($"Operation error (unexpected exception type): {actualException.GetType()}"); _incrementOperationErrors(); } else { Console.WriteLine($"Operation cancelled: {actualException}"); } return; } if (test._expectedResult() == null) { _incrementOperationSuccesses(); } else { try { test.AssertResult(); _incrementOperationSuccesses(); } catch (Exception ex) { Console.WriteLine($"Operation failure (unexpected exception type): {ex.GetType()}"); _incrementOperationFailures(); } } } else { if (actualException == null) { _incrementOperationErrors(); return; } try { test.AssertException(); _incrementOperationSuccesses(); } catch { _incrementOperationFailures(); } } }
protected virtual void AssertOperation(JsonDrivenTest jsonDrivenTest) { jsonDrivenTest.Assert(); }
public static void AssertResult(this JsonDrivenTest test) { Reflector.Invoke(test, nameof(AssertResult)); }
public static void AssertException(this JsonDrivenTest test) { Reflector.Invoke(test, nameof(AssertException)); }
public static BsonValue _expectedResult(this JsonDrivenTest test) { return((BsonValue)Reflector.GetFieldValue(test, nameof(_expectedResult))); }
public static BsonDocument _expectedException(this JsonDrivenTest test) { return((BsonDocument)Reflector.GetFieldValue(test, nameof(_expectedException))); }
public static Exception _actualException(this JsonDrivenTest test) { return((Exception)Reflector.GetFieldValue(test, nameof(_actualException))); }