public void SetsReturnNullableEnum() { var method = typeof(IDefaultValues).GetMethod(nameof(IDefaultValues.ReturnNullableEnum)); var behavior = new DefaultValueProxyBehavior(); var result = behavior.Invoke(new MethodInvocation(new object(), method, new object[0]), () => null); Assert.Null(result.ReturnValue); }
public void SetsReturnGenericEnumerable() { var method = typeof(IDefaultValues).GetMethod(nameof(IDefaultValues.ReturnGenericEnumerable)); var behavior = new DefaultValueProxyBehavior(); var result = behavior.Invoke(new MethodInvocation(new object(), method, new object[0]), () => null); Assert.NotNull(result.ReturnValue); Assert.True(result.ReturnValue is IEnumerable <object>); }
public void SetsReturnGenericTask() { var method = typeof(IDefaultValues).GetMethod(nameof(IDefaultValues.ReturnGenericTask)); var behavior = new DefaultValueProxyBehavior(); var result = behavior.Invoke(new MethodInvocation(new object(), method, new object[0]), () => null); Assert.NotNull(result.ReturnValue); Assert.True(result.ReturnValue is Task <object>); Assert.True(((Task)result.ReturnValue).IsCompleted); }
public void SetsReturnArray() { var method = typeof(IDefaultValues).GetMethod(nameof(IDefaultValues.ReturnArray)); var behavior = new DefaultValueProxyBehavior(); var result = behavior.Invoke(new MethodInvocation(new object(), method, new object[0]), () => null); Assert.NotNull(result.ReturnValue); Assert.True(result.ReturnValue is object[]); Assert.Equal(0, ((Array)result.ReturnValue).Length); }
public void SetsOutValue() { var method = typeof(IDefaultValues).GetMethod(nameof(IDefaultValues.VoidWithOut)); var behavior = new DefaultValueProxyBehavior(); var result = behavior.Invoke(new MethodInvocation(new object(), method, new object[1]), () => null); Assert.Equal(1, result.Outputs.Count); Assert.NotNull(result.Outputs[0]); Assert.True(result.Outputs[0] is object[]); }