|
|
|
@ -23,8 +23,8 @@ namespace Avalonia.Markup.UnitTests.Parsers |
|
|
|
|
|
|
|
public static void StaticMethod() { } |
|
|
|
|
|
|
|
public static void TooManyParameters(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9) { } |
|
|
|
public static int TooManyParametersWithReturnType(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) => 1; |
|
|
|
public static void ManyParameters(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9) { } |
|
|
|
public static int ManyParametersWithReturnType(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) => 1; |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
@ -44,6 +44,8 @@ namespace Avalonia.Markup.UnitTests.Parsers |
|
|
|
[InlineData(nameof(TestObject.MethodWithReturn), typeof(Func<int>))] |
|
|
|
[InlineData(nameof(TestObject.MethodWithReturnAndParameters), typeof(Func<int, int>))] |
|
|
|
[InlineData(nameof(TestObject.StaticMethod), typeof(Action))] |
|
|
|
[InlineData(nameof(TestObject.ManyParameters), typeof(Action<int, int, int, int, int, int, int, int, int>))] |
|
|
|
[InlineData(nameof(TestObject.ManyParametersWithReturnType), typeof(Func<int, int, int, int, int, int, int, int, int>))] |
|
|
|
public async Task Should_Get_Method_WithCorrectDelegateType(string methodName, Type expectedType) |
|
|
|
{ |
|
|
|
var data = new TestObject(); |
|
|
|
@ -68,21 +70,5 @@ namespace Avalonia.Markup.UnitTests.Parsers |
|
|
|
|
|
|
|
GC.KeepAlive(data); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[InlineData(nameof(TestObject.TooManyParameters))] |
|
|
|
[InlineData(nameof(TestObject.TooManyParametersWithReturnType))] |
|
|
|
public async Task Should_Return_Error_Notification_If_Too_Many_Parameters(string methodName) |
|
|
|
{ |
|
|
|
var data = new TestObject(); |
|
|
|
var observer = ExpressionObserverBuilder.Build(data, methodName); |
|
|
|
var result = await observer.Take(1); |
|
|
|
|
|
|
|
Assert.IsType<BindingNotification>(result); |
|
|
|
|
|
|
|
Assert.Equal(BindingErrorType.Error, ((BindingNotification)result).ErrorType); |
|
|
|
|
|
|
|
GC.KeepAlive(data); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|