public static void ExecuteViaReflection_void___Should_throw_same_exception_throw_by_protocol___When_protocol_throws() { // Arrange var operation = new ThrowingVoidOp(); var protocol = new ThrowingProtocol(); // Act var actual = Record.Exception(() => protocol.ExecuteViaReflection(operation)); // Assert actual.AsTest().Must().BeOfType <InvalidOperationException>(); actual.Message.AsTest().Must().BeEqualTo("execute-void-sync"); }
public static async Task ExecuteViaReflectionAsync_TResult___Should_throw_same_exception_throw_by_protocol___When_protocol_throws() { // Arrange var operation = new ThrowingReturningOp(); var protocol = new ThrowingProtocol(); // Act var actual = await Record.ExceptionAsync(() => protocol.ExecuteViaReflectionAsync <bool>(operation)); // Assert actual.AsTest().Must().BeOfType <InvalidOperationException>(); actual.Message.AsTest().Must().BeEqualTo("execute-returning-async"); }