public async Task SyncAction() { string inputString = "hello"; var syncMethod = new SyncMethod(_controller.Echo); var result = await ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new Dictionary <string, object>() { { "input", inputString } }); Assert.Equal(inputString, result); }
public async Task SyncAction_WithException() { string inputString = "hello"; var syncMethod = new SyncMethod(_controller.EchoWithException); await Assert.ThrowsAsync <NotImplementedException>( () => ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new Dictionary <string, object>() { { "input", inputString } })); }
public async Task ExecuteAsync_WithArgumentDictionary_AnyValue_HasPrecedenceOverDefaults() { // Arrange var syncMethod = new SyncMethod(_controller.EchoWithDefaultValueAndAttribute); // Act var result = await ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new Dictionary <string, object>() { { "input", null } }); // Assert Assert.Null(result); }
public async Task ExecuteAsync_WithArgumentDictionary_DefaultParameterValueUsed() { // Arrange var syncMethod = new SyncMethod(_controller.EchoWithDefaultValueAndAttribute); // Act var result = await ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new Dictionary <string, object>()); // Assert Assert.Equal("world", result); }
public async Task ExecuteAsync_WithArgumentArray_DefaultValueAttributeIgnored() { // Arrange var syncMethod = new SyncMethod(_controller.EchoWithDefaultValue); // Act var result = await ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new object[] { null, }); // Assert Assert.Null(result); }
public async Task SyncAction_WithException() { string inputString = "hello"; var syncMethod = new SyncMethod(_controller.EchoWithException); var expectedException = "The method or operation is not implemented."; await AssertThrowsAsync <NotImplementedException>( async() => await ReflectedActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new Dictionary <string, object>() { { "input", inputString } }), expectedException); }
public async Task SyncAction_WithException() { // Arrange var inputString = "hello"; var syncMethod = new SyncMethod(_controller.EchoWithException); // Act & Assert await Assert.ThrowsAsync<NotImplementedException>( () => ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new Dictionary<string, object>() { { "input", inputString } })); }
public async Task SyncAction() { // Arrange var inputString = "hello"; var syncMethod = new SyncMethod(_controller.Echo); // Act var result = await ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new Dictionary<string, object>() { { "input", inputString } }); // Assert Assert.Equal(inputString, result); }
public async Task ExecuteAsync_WithArgumentDictionary_AnyValue_HasPrecedenceOverDefaults() { // Arrange var syncMethod = new SyncMethod(_controller.EchoWithDefaultValueAndAttribute); // Act var result = await ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new Dictionary<string, object>() { { "input", null } }); // Assert Assert.Null(result); }
public async Task ExecuteAsync_WithArgumentDictionary_DefaultParameterValueUsed() { // Arrange var syncMethod = new SyncMethod(_controller.EchoWithDefaultValueAndAttribute); // Act var result = await ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new Dictionary<string, object>()); // Assert Assert.Equal("world", result); }
public async Task ExecuteAsync_WithArgumentArray_DefaultValueAttributeIgnored() { // Arrange var syncMethod = new SyncMethod(_controller.EchoWithDefaultValue); // Act var result = await ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new object[] { null, }); // Assert Assert.Null(result); }