/// <inheritdoc /> protected override IMockHandler CreateHandler(LambdaExpression expression) { MockConfigurationContext.ResetContext(); InvokeExpression(expression); if (MockConfigurationContext.TryGetApiInvoked(out var targetPath)) { return(new MockApiHandler() { ApiTargetPath = targetPath }); } throw new InvalidOperationException("There was no invocation on the API."); }
/// <inheritdoc /> protected override IMockHandler CreateHandler(LambdaExpression expression) { MockConfigurationContext.ResetContext(); InvokeExpression(expression); if (MockConfigurationContext.TryGetObjectReferenceInvoked(out var obj, out var targetPath)) { if (!objectReference.Equals(obj)) { throw new InvalidOperationException("Object reference invoked is different from the object reference configured."); } return(new MockObjectReferenceHandler() { ObjectReference = obj, TargetPath = targetPath }); } throw new InvalidOperationException("There was no invocation on the object reference to mock."); }